Skip to content

Commit 41e1611

Browse files
committed
Chore: update release process
1 parent 08365bc commit 41e1611

2 files changed

Lines changed: 112 additions & 57 deletions

File tree

.github/workflows/release.yml

Lines changed: 100 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,100 @@
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 validate script
47+
run: npm run validate
48+
49+
- name: ⬆️ Upload coverage report
50+
uses: codecov/codecov-action@v5
51+
with:
52+
fail_ci_if_error: true
53+
flags: node-${{ matrix.node }}
54+
token: ${{ secrets.CODECOV_TOKEN }}
55+
56+
release:
57+
permissions:
58+
id-token: write # to enable use of OIDC (npm trusted publishing and provenance)
59+
actions: write # to cancel/stop running workflows
60+
contents: write # to create release tags
61+
issues: write # to post release notes that resolve issues
62+
pull-requests: write # to comment on released pull requests
63+
64+
needs: validate
65+
runs-on: ubuntu-latest
66+
if:
67+
${{ github.repository == 'testing-library/preact-testing-library' &&
68+
github.event_name == 'push' }}
69+
steps:
70+
- name: ⬇️ Checkout repo
71+
uses: actions/checkout@v4
72+
73+
- name: ⎔ Setup node
74+
uses: actions/setup-node@v4
75+
with:
76+
node-version: 24
77+
78+
- name: 📥 Download deps
79+
uses: bahmutov/npm-install@v1
80+
with:
81+
useLockFile: false
82+
83+
- name: 🏗 Run build script
84+
run: npm run build
85+
86+
- name: 🚀 Release
87+
uses: cycjimmy/semantic-release-action@v5
88+
with:
89+
semantic_version: 25
90+
branches: |
91+
[
92+
'+([0-9])?(.{+([0-9]),x}).x',
93+
'main',
94+
'next',
95+
'next-major',
96+
{name: 'beta', prerelease: true},
97+
{name: 'alpha', prerelease: true}
98+
]
99+
env:
100+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}

.github/workflows/validate.yml

Lines changed: 12 additions & 57 deletions
Original file line numberDiff line numberDiff line change
@@ -1,89 +1,44 @@
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
4135

4236
- name: ▶️ Run validate script
4337
run: npm run validate
4438

4539
- name: ⬆️ Upload coverage report
46-
uses: codecov/codecov-action@v2
47-
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
58-
59-
- name: ⎔ Setup node
60-
uses: actions/setup-node@v2
61-
with:
62-
node-version: 14
63-
64-
- name: 📥 Download deps
65-
uses: bahmutov/npm-install@v1
66-
with:
67-
useLockFile: false
68-
env:
69-
HUSKY_SKIP_INSTALL: true
70-
71-
- name: 🏗 Run build script
72-
run: npm run build
73-
74-
- name: 🚀 Release
75-
uses: cycjimmy/semantic-release-action@v2
40+
uses: codecov/codecov-action@v5
7641
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 }}
42+
fail_ci_if_error: true
43+
flags: node-${{ matrix.node }}
44+
token: ${{ secrets.CODECOV_TOKEN }}

0 commit comments

Comments
 (0)