@@ -3,50 +3,80 @@ name: CI
33on :
44 push :
55 branches : [main]
6+ pull_request :
7+ branches : [main]
68
79jobs :
8- test :
10+ main :
911 # ignore all-contributors PRs
1012 if : ${{ !contains(github.head_ref, 'all-contributors') }}
11-
12- runs-on : ubuntu-latest
13-
1413 strategy :
1514 matrix :
1615 node : [10, 12, 14, 16]
17-
16+ runs-on : ubuntu-latest
1817 steps :
19- - name : Cancel previous runs
20- uses : styfle/cancel-workflow-action@0.9.0
18+ - name : 🛑 Cancel Previous Runs
19+ uses : styfle/cancel-workflow-action@0.9.1
20+
21+ - name : ⬇️ Checkout repo
22+ uses : actions/checkout@v3
23+
24+ - name : ⎔ Setup node
25+ uses : actions/setup-node@v3
26+ with :
27+ node-version : ${{ matrix.node }}
2128
22- - uses : actions/checkout@v2
29+ - name : 📥 Download deps
30+ uses : bahmutov/npm-install@v1
31+ with :
32+ useLockFile : false
2333
24- - name : Setup nodejs
25- uses : actions/setup-node@v2
26- with :
27- node-version : ${{ matrix.node }}
28- - name : Install deps & validate
29- run : npm run setup
34+ - name : ▶️ Run validate script
35+ run : npm run validate
36+
37+ - name : ⬆️ Upload coverage report
38+ uses : codecov/codecov-action@v2
3039
3140 release :
41+ needs : main
3242 runs-on : ubuntu-latest
33-
43+ if :
44+ ${{ github.repository == 'testing-library/svelte-testing-library' &&
45+ contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha',
46+ github.ref) && github.event_name == 'push' }}
3447 steps :
35- - name : Cancel previous runs
36- uses : styfle/cancel-workflow-action@0.9.0
37-
38- - uses : actions/checkout@v2
39-
40- - name : Setup nodejs
41- uses : actions/setup-node@v2
42- with :
43- node-version : 14
44- - name : Install deps
45- run : npm install
46- - name : Build proj
47- run : npm run build
48- - name : Update tests, coverage, and release
49- run : npm run test:update && npx codecov && npx semantic-release
50- env :
51- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
52- GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
48+ - name : 🛑 Cancel Previous Runs
49+ uses : styfle/cancel-workflow-action@0.9.1
50+
51+ - name : ⬇️ Checkout repo
52+ uses : actions/checkout@v3
53+
54+ - name : ⎔ Setup node
55+ uses : actions/setup-node@v3
56+ with :
57+ node-version : 16
58+
59+ - name : 📥 Download deps
60+ uses : bahmutov/npm-install@v1
61+ with :
62+ useLockFile : false
63+
64+ - name : 🏗 Run build script
65+ run : npm run build
66+
67+ - name : 🚀 Release
68+ uses : cycjimmy/semantic-release-action@v2
69+ with :
70+ semantic_version : 17
71+ branches : |
72+ [
73+ '+([0-9])?(.{+([0-9]),x}).x',
74+ 'main',
75+ 'next',
76+ 'next-major',
77+ {name: 'beta', prerelease: true},
78+ {name: 'alpha', prerelease: true}
79+ ]
80+ env :
81+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
82+ NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
0 commit comments