Skip to content

Commit 6a81011

Browse files
committed
ci(release): semantic release
Add semantic-release for automated versioning and create release workflow
1 parent e92633e commit 6a81011

File tree

3 files changed

+1853
-15
lines changed

3 files changed

+1853
-15
lines changed
Lines changed: 27 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,29 @@
1-
name: Release to npm
1+
name: Release
22

33
on:
44
workflow_dispatch:
55
release:
66
types: [created] # Runs only when a new GitHub Release is created
77

8+
permissions:
9+
contents: read
10+
811
jobs:
9-
build:
10-
name: Build
12+
release:
13+
name: Release
1114
runs-on: ubuntu-latest
15+
16+
permissions:
17+
contents: write # to be able to publish a GitHub release
18+
issues: write # to be able to comment on released issues
19+
pull-requests: write # to be able to comment on released pull requests
20+
id-token: write # to enable use of OIDC for npm provenance
21+
1222
steps:
1323
- name: Checkout repository
1424
uses: actions/checkout@v4
25+
with:
26+
fetch-depth: 0
1527

1628
- name: Setup pnpm
1729
uses: pnpm/action-setup@v4
@@ -29,6 +41,9 @@ jobs:
2941
- name: Install dependencies
3042
run: pnpm install
3143

44+
- name: Verify the integrity of provenance attestations and registry signatures for installed dependencies
45+
run: pnpm audit signatures
46+
3247
- name: Run lint
3348
run: pnpm lint
3449

@@ -41,7 +56,13 @@ jobs:
4156
- name: Authenticate npm
4257
run: echo "//registry.npmjs.org/:_authToken=${{ secrets.NPM_TOKEN }}" > ${{ github.workspace }}/.npmrc
4358

44-
- name: Publish to npm
45-
run: pnpm publish --access public
59+
- name: Release
4660
env:
47-
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
61+
GITHUB_TOKEN: ${{ secrets.GH_TOKEN }}
62+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
63+
run: npx semantic-release
64+
65+
# - name: Publish to npm
66+
# run: pnpm publish --access public
67+
# env:
68+
# NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -50,6 +50,7 @@
5050
"@typescript-eslint/parser": "^8.25.0",
5151
"eslint": "^9.21.0",
5252
"globals": "^16.0.0",
53+
"semantic-release": "^24.2.3",
5354
"ts-node": "^10.9.2",
5455
"tsup": "^8.4.0",
5556
"typescript": "^5.8.2"

0 commit comments

Comments
 (0)