Skip to content

Commit 19cb7dd

Browse files
committed
chore: add changesets release workflow
Changesets action creates a "version packages" PR when changesets are present on main. Merging that PR triggers npm publish with OIDC provenance. Requires NPM_TOKEN secret on the repo.
1 parent 3929ae2 commit 19cb7dd

2 files changed

Lines changed: 49 additions & 3 deletions

File tree

.github/workflows/release.yml

Lines changed: 48 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,48 @@
1+
name: Release
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
8+
concurrency: ${{ github.workflow }}-${{ github.ref }}
9+
10+
permissions:
11+
contents: write
12+
pull-requests: write
13+
id-token: write
14+
15+
jobs:
16+
release:
17+
name: Release
18+
runs-on: ubuntu-latest
19+
steps:
20+
- uses: actions/checkout@v4
21+
22+
- uses: pnpm/action-setup@v4
23+
with:
24+
version: 10
25+
26+
- uses: actions/setup-node@v4
27+
with:
28+
node-version: 22
29+
cache: pnpm
30+
registry-url: https://registry.npmjs.org
31+
32+
- run: pnpm install --frozen-lockfile
33+
34+
- run: pnpm build
35+
36+
- run: pnpm typecheck
37+
38+
- name: Create Release PR or Publish
39+
uses: changesets/action@v1
40+
with:
41+
title: "chore: version packages"
42+
commit: "chore: version packages"
43+
version: pnpm changeset version
44+
publish: pnpm changeset publish
45+
env:
46+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
47+
NPM_CONFIG_PROVENANCE: true
48+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}

package.json

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -39,9 +39,7 @@
3939
"dev": "tsc --watch",
4040
"test": "vitest",
4141
"typecheck": "tsc --noEmit",
42-
"changeset": "changeset",
43-
"version": "changeset version",
44-
"release": "pnpm build && changeset publish"
42+
"changeset": "changeset"
4543
},
4644
"devDependencies": {
4745
"@changesets/cli": "^2.27.0",

0 commit comments

Comments
 (0)