Skip to content

Commit 46fd2c5

Browse files
feat: add semantic-release
1 parent 70bbca9 commit 46fd2c5

File tree

2 files changed

+62
-13
lines changed

2 files changed

+62
-13
lines changed

.github/workflows/release.yml

Lines changed: 39 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -9,17 +9,30 @@ jobs:
99
ci:
1010
runs-on: ubuntu-latest
1111
steps:
12-
- uses: actions/checkout@v5
13-
- uses: actions/setup-node@v5
12+
- name: Checkout repository
13+
uses: actions/checkout@v5
14+
15+
- name: Setup Node.js 22 (cache npm)
16+
uses: actions/setup-node@v5
1417
with:
1518
node-version: 22
1619
cache: npm
1720
registry-url: https://registry.npmjs.org
18-
- run: npm ci
19-
- run: npm run format:check
20-
- run: npm run lint
21-
- run: npm run build
22-
- run: npm test
21+
22+
- name: Install dependencies
23+
run: npm ci
24+
25+
- name: Check formatting
26+
run: npm run format:check
27+
28+
- name: Run linter
29+
run: npm run lint
30+
31+
- name: Build project
32+
run: npm run build
33+
34+
- name: Run tests (with coverage)
35+
run: npm test
2336

2437
publish:
2538
if: github.ref == 'refs/heads/main'
@@ -29,14 +42,27 @@ jobs:
2942
contents: write
3043
id-token: write
3144
steps:
32-
- uses: actions/checkout@v5
33-
- uses: actions/setup-node@v5
45+
- name: Checkout repository
46+
uses: actions/checkout@v5
47+
48+
- name: Setup Node.js 22 (cache npm)
49+
uses: actions/setup-node@v5
3450
with:
3551
node-version: 22
3652
cache: npm
3753
registry-url: https://registry.npmjs.org
38-
- run: npm ci
39-
- run: npm run build
40-
- run: npm publish --provenance --access public
54+
55+
- name: Install dependencies
56+
run: npm ci
57+
58+
- name: Build project (before release)
59+
run: npm run build
60+
61+
- name: Verify provenance attestations and registry signatures
62+
run: npm audit signatures
63+
64+
- name: Run semantic-release
4165
env:
42-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
66+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
67+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
68+
run: npx semantic-release

.releaserc.cjs

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,23 @@
1+
module.exports = {
2+
branches: ["main"],
3+
plugins: [
4+
"@semantic-release/commit-analyzer",
5+
"@semantic-release/release-notes-generator",
6+
[
7+
"@semantic-release/changelog",
8+
{
9+
changelogFile: "CHANGELOG.md",
10+
},
11+
],
12+
[
13+
"@semantic-release/npm",
14+
{
15+
// keep npmPublish true to publish to npm,
16+
// but we are NOT using @semantic-release/git so package.json
17+
// won't be committed back to the repo.
18+
npmPublish: true,
19+
},
20+
],
21+
"@semantic-release/github",
22+
],
23+
};

0 commit comments

Comments
 (0)