Skip to content

Commit c509d96

Browse files
authored
Chore: update release process (#79)
* Chore: update release process * Add explicit coverage flag * Temp skip coverage upload because of invalid token
1 parent 08365bc commit c509d96

2 files changed

Lines changed: 128 additions & 55 deletions

File tree

‎.github/workflows/release.yml‎

Lines changed: 109 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,109 @@
1+
name: release
2+
on:
3+
push:
4+
branches:
5+
# Match SemVer major release branches
6+
# e.g. "12.x" or "8.x"
7+
- '[0-9]+.x'
8+
- 'main'
9+
- 'next'
10+
- 'next-major'
11+
- 'beta'
12+
- 'alpha'
13+
- '!all-contributors/**'
14+
15+
concurrency:
16+
group: ${{ github.workflow }}-${{ github.ref }}
17+
cancel-in-progress: true
18+
19+
permissions: {}
20+
21+
jobs:
22+
validate:
23+
permissions:
24+
contents: read # to fetch code (actions/checkout)
25+
# ignore all-contributors PRs
26+
if: ${{ !contains(github.head_ref, 'all-contributors') }}
27+
strategy:
28+
fail-fast: false
29+
matrix:
30+
node: [20, 22, 24]
31+
runs-on: ubuntu-latest
32+
steps:
33+
- name: ⬇️ Checkout repo
34+
uses: actions/checkout@v4
35+
36+
- name: ⎔ Setup node
37+
uses: actions/setup-node@v4
38+
with:
39+
node-version: ${{ matrix.node }}
40+
41+
- name: 📥 Download deps
42+
uses: bahmutov/npm-install@v1
43+
with:
44+
useLockFile: false
45+
46+
- name: 🧹 Run lint script
47+
run: npm run lint
48+
49+
- name: 🧪 Run tests with coverage
50+
run: npm test -- --coverage
51+
52+
- name: 🧼 Run clean script
53+
run: npm run clean
54+
55+
- name: 🏗 Run build script
56+
run: npm run build
57+
58+
- name: ⬆️ Upload coverage report
59+
uses: codecov/codecov-action@v5
60+
with:
61+
fail_ci_if_error: false # Temp because token is invalid
62+
flags: node-${{ matrix.node }}
63+
token: ${{ secrets.CODECOV_TOKEN }}
64+
65+
release:
66+
permissions:
67+
id-token: write # to enable use of OIDC (npm trusted publishing and provenance)
68+
actions: write # to cancel/stop running workflows
69+
contents: write # to create release tags
70+
issues: write # to post release notes that resolve issues
71+
pull-requests: write # to comment on released pull requests
72+
73+
needs: validate
74+
runs-on: ubuntu-latest
75+
if:
76+
${{ github.repository == 'testing-library/preact-testing-library' &&
77+
github.event_name == 'push' }}
78+
steps:
79+
- name: ⬇️ Checkout repo
80+
uses: actions/checkout@v4
81+
82+
- name: ⎔ Setup node
83+
uses: actions/setup-node@v4
84+
with:
85+
node-version: 24
86+
87+
- name: 📥 Download deps
88+
uses: bahmutov/npm-install@v1
89+
with:
90+
useLockFile: false
91+
92+
- name: 🏗 Run build script
93+
run: npm run build
94+
95+
- name: 🚀 Release
96+
uses: cycjimmy/semantic-release-action@v5
97+
with:
98+
semantic_version: 25
99+
branches: |
100+
[
101+
'+([0-9])?(.{+([0-9]),x}).x',
102+
'main',
103+
'next',
104+
'next-major',
105+
{name: 'beta', prerelease: true},
106+
{name: 'alpha', prerelease: true}
107+
]
108+
env:
109+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

‎.github/workflows/validate.yml‎

Lines changed: 19 additions & 55 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,53 @@
11
name: validate
22
on:
3-
push:
4-
branches:
5-
- '+([0-9])?(.{+([0-9]),x}).x'
6-
- 'main'
7-
- 'next'
8-
- 'next-major'
9-
- 'beta'
10-
- 'alpha'
11-
- '!all-contributors/**'
123
pull_request:
134

145
concurrency:
156
group: ${{ github.workflow }}-${{ github.ref }}
167
cancel-in-progress: true
178

9+
permissions: {}
10+
1811
jobs:
1912
main:
13+
permissions:
14+
contents: read # to fetch code (actions/checkout)
2015
# ignore all-contributors PRs
2116
if: ${{ !contains(github.head_ref, 'all-contributors') }}
2217
strategy:
18+
fail-fast: false
2319
matrix:
24-
node: [16, 18, 20]
20+
node: [20, 22, 24]
2521
runs-on: ubuntu-latest
2622
steps:
2723
- name: ⬇️ Checkout repo
28-
uses: actions/checkout@v2
24+
uses: actions/checkout@v4
2925

3026
- name: ⎔ Setup node
31-
uses: actions/setup-node@v2
27+
uses: actions/setup-node@v4
3228
with:
3329
node-version: ${{ matrix.node }}
3430

3531
- name: 📥 Download deps
3632
uses: bahmutov/npm-install@v1
3733
with:
3834
useLockFile: false
39-
env:
40-
HUSKY_SKIP_INSTALL: true
41-
42-
- name: ▶️ Run validate script
43-
run: npm run validate
44-
45-
- name: ⬆️ Upload coverage report
46-
uses: codecov/codecov-action@v2
4735

48-
release:
49-
needs: main
50-
runs-on: ubuntu-latest
51-
if:
52-
${{ github.repository == 'testing-library/preact-testing-library' &&
53-
contains('refs/heads/main,refs/heads/beta,refs/heads/next,refs/heads/alpha', github.ref) &&
54-
github.event_name == 'push' }}
55-
steps:
56-
- name: ⬇️ Checkout repo
57-
uses: actions/checkout@v2
36+
- name: 🧹 Run lint script
37+
run: npm run lint
5838

59-
- name: ⎔ Setup node
60-
uses: actions/setup-node@v2
61-
with:
62-
node-version: 14
39+
- name: 🧪 Run tests with coverage
40+
run: npm test -- --coverage
6341

64-
- name: 📥 Download deps
65-
uses: bahmutov/npm-install@v1
66-
with:
67-
useLockFile: false
68-
env:
69-
HUSKY_SKIP_INSTALL: true
42+
- name: 🧼 Run clean script
43+
run: npm run clean
7044

7145
- name: 🏗 Run build script
7246
run: npm run build
7347

74-
- name: 🚀 Release
75-
uses: cycjimmy/semantic-release-action@v2
48+
- name: ⬆️ Upload coverage report
49+
uses: codecov/codecov-action@v5
7650
with:
77-
semantic_version: 17
78-
branches: |
79-
[
80-
'+([0-9])?(.{+([0-9]),x}).x',
81-
'main',
82-
'next',
83-
'next-major',
84-
{name: 'beta', prerelease: true},
85-
{name: 'alpha', prerelease: true}
86-
]
87-
env:
88-
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
89-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
51+
fail_ci_if_error: false # Temp because token is invalid
52+
flags: node-${{ matrix.node }}
53+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)