-
Notifications
You must be signed in to change notification settings - Fork 281
117 lines (117 loc) · 3.17 KB
/
publish.yml
File metadata and controls
117 lines (117 loc) · 3.17 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
name: Test
on:
push:
pull_request:
jobs:
is_release:
runs-on: ubuntu-latest
outputs:
type: ${{ steps.get_type.outputs.type }}
continue-on-error: true
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- id: get_type
run: echo $( git tag --points-at HEAD | grep -q -e '^.*@.*$' && echo 'type=::release::' || echo "type=::norelease::" ) >> "$GITHUB_OUTPUT"
test:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [16.x, 18.x, 20.x, 22.x]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: npm install
- run: npm run test
test_legacy:
needs: [is_release]
if: ${{ needs.is_release.outputs.type == '::norelease::' }}
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [14.x]
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- name: Use Node.js ${{ matrix.node-version }}
uses: actions/setup-node@v4
with:
node-version: ${{ matrix.node-version }}
- run: |
cwd=`pwd`
for pkg in packages/*/package.json; do
cd $cwd/`dirname $pkg`
npm install
npm run test:legacy;
done
# - run: |
# echo 'Test csv generate'
# cwd=`pwd`
# cd $cwd/packages/csv-generate
# npm install
# npm run test:legacy
# npm link
# cd $pwd
# - run: |
# echo 'Test stream transform'
# cwd=`pwd`
# cd $cwd/packages/stream-transform
# npm install
# npm link csv-generate
# npm run test:legacy
# npm link
# cd $pwd
# - run: |
# echo 'Test csv parse'
# cwd=`pwd`
# cd $cwd/packages/csv-parse
# npm install
# npm link csv-generate
# npm link stream-transform
# npm run test:legacy
# npm link
# cd $pwd
# - run: |
# echo 'Test csv stringify'
# cwd=`pwd`
# cd $cwd/packages/csv-stringify
# npm install
# npm link csv-generate
# npm run test:legacy
# npm link
# cd $pwd
# - run: |
# echo 'Test csv'
# cwd=`pwd`
# cd $cwd/packages/csv
# npm install
# npm link csv-generate
# npm link csv-parse
# npm link csv-stringify
# npm link stream-transform
# npm run test:legacy
# npm link
# cd $pwd
publish:
needs: [is_release, test]
if: ${{ needs.is_release.outputs.type == '::release::' }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: actions/setup-node@v4
with:
node-version: "22.x"
registry-url: "https://registry.npmjs.org"
- run: npm ci
- run: npm run publish
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}