Skip to content

Commit b4ba6ed

Browse files
authored
chore: fix CI actions (#173)
1 parent 78e5047 commit b4ba6ed

File tree

1 file changed

+59
-38
lines changed

1 file changed

+59
-38
lines changed

.github/workflows/release.yml

+59-38
Original file line numberDiff line numberDiff line change
@@ -7,55 +7,76 @@ on:
77
branches: [main]
88

99
jobs:
10-
test:
10+
main:
1111
# ignore all-contributors PRs
1212
if: ${{ !contains(github.head_ref, 'all-contributors') }}
13-
14-
runs-on: ubuntu-latest
15-
1613
strategy:
1714
matrix:
1815
node: [10.x, 12.x]
19-
16+
runs-on: ubuntu-latest
2017
steps:
21-
- name: Cancel previous runs
22-
uses: styfle/[email protected]
23-
with:
24-
access_token: ${{ secrets.GITHUB_TOKEN }}
18+
- name: 🛑 Cancel Previous Runs
19+
uses: styfle/[email protected]
20+
21+
- name: ⬇️ Checkout repo
22+
uses: actions/checkout@v2
23+
24+
- name: ⎔ Setup node
25+
uses: actions/setup-node@v2
26+
with:
27+
node-version: ${{ matrix.node }}
2528

26-
- uses: actions/checkout@v2
29+
- name: 📥 Download deps
30+
uses: bahmutov/npm-install@v1
31+
with:
32+
useLockFile: false
2733

28-
- name: Setup nodejs
29-
uses: actions/setup-node@v2-beta
30-
with:
31-
node-version: ${{ matrix.node }}
32-
- name: Install deps & validate
33-
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@v1
3439

3540
release:
41+
needs: main
3642
runs-on: ubuntu-latest
3743
if:
3844
${{ github.repository == 'testing-library/svelte-testing-library' &&
39-
github.ref == 'refs/heads/main' && github.event_name == 'push' }}
40-
45+
contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha',
46+
github.ref) && github.event_name == 'push' }}
4147
steps:
42-
- name: Cancel previous runs
43-
uses: styfle/[email protected]
44-
with:
45-
access_token: ${{ secrets.GITHUB_TOKEN }}
46-
47-
- uses: actions/checkout@v2
48-
49-
- name: Setup nodejs
50-
uses: actions/setup-node@v2-beta
51-
with:
52-
node-version: 14
53-
- name: Install deps
54-
run: npm install
55-
- name: Build proj
56-
run: npm run build
57-
- name: Update tests, coverage, and release
58-
run: npm run test:update && npx codecov && npx semantic-release
59-
env:
60-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
61-
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
48+
- name: 🛑 Cancel Previous Runs
49+
uses: styfle/[email protected]
50+
51+
- name: ⬇️ Checkout repo
52+
uses: actions/checkout@v2
53+
54+
- name: ⎔ Setup node
55+
uses: actions/setup-node@v2
56+
with:
57+
node-version: 14
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

Comments
 (0)