11name : Release
22
3- # This workflow runs after CI succeeds on the main branch.
4- # Uses Changesets for version management and automatic releases.
5- #
6- # Features:
7- # - Creates version PRs automatically when changesets are merged
8- # - Publishes to npm with provenance (trusted publishing)
9- # - Creates GitHub releases automatically
10- #
11- # Setup:
12- # 1. Set "private": false in package.json to enable publishing
13- # 2. Configure npm trusted publishing (no token needed with provenance)
14- # 3. Merge changeset files to trigger version PR
15- # 4. Merge version PR to publish and create GitHub release
16-
173on :
18- workflow_run :
19- workflows : ["CI"]
20- types :
21- - completed
4+ push :
225 branches :
236 - main
24- workflow_dispatch :
25- inputs :
26- force_publish :
27- description : ' Force publish all packages'
28- type : boolean
29- default : false
307
318concurrency : ${{ github.workflow }}-${{ github.ref }}
329
10+ permissions :
11+ contents : write
12+ pull-requests : write
13+ id-token : write # Required for OIDC trusted publishing
14+
3315jobs :
3416 release :
3517 name : Release
3618 runs-on : ubuntu-latest
37- # Only run if CI workflow succeeded
38- if : ${{ github.event.workflow_run.conclusion == 'success' || github.event_name == 'workflow_dispatch' }}
39- permissions :
40- contents : write # Create releases and tags
41- pull-requests : write # Create version PRs
42- id-token : write # Trusted publishing with npm
4319 steps :
4420 - name : Checkout Repo
4521 uses : actions/checkout@v4
4622 with :
47- # This makes Actions fetch all Git history so that Changesets can generate changelogs
23+ # This makes sure we fetch all history so Changesets can compare versions
4824 fetch-depth : 0
4925
5026 - name : Setup pnpm
51- uses : pnpm/action-setup@v3
27+ uses : pnpm/action-setup@v4
5228 with :
5329 version : 8
5430
55- - name : Setup Node.js
31+ - name : Setup Node.js 22.x
5632 uses : actions/setup-node@v4
5733 with :
58- node-version : 22
34+ node-version : 22.x
5935 cache : ' pnpm'
6036 registry-url : ' https://registry.npmjs.org'
6137
38+ # Ensure npm 11.5.1+ for trusted publishing support
39+ - name : Update npm
40+ run : npm install -g npm@latest
41+
6242 - name : Install Dependencies
63- run : pnpm install
43+ run : pnpm install --frozen-lockfile
6444
6545 - name : Build Packages
6646 run : pnpm build
67-
47+
6848 - name : Create Release Pull Request or Publish to npm
6949 id : changesets
7050 uses : changesets/action@v1
7151 with :
52+ # This creates a "Version Packages" PR when changesets are added
7253 version : pnpm changeset version
73- publish : pnpm changeset publish --provenance
74- commit : ' chore(release): version packages'
75- title : ' chore(release): version packages'
54+ # This publishes to npm when the version PR is merged
55+ # Uses OIDC trusted publishing - no NPM_TOKEN needed!
56+ publish : pnpm changeset publish
57+ # Commit message for version bumps
58+ commit : ' chore: release packages'
59+ # PR title for version bumps
60+ title : ' chore: release packages'
61+ # Create GitHub Releases
7662 createGithubReleases : true
7763 env :
7864 GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
79- NPM_TOKEN : ${{ secrets.NPM_TOKEN }}
80- NODE_AUTH_TOKEN : ${{ secrets.NPM_TOKEN }}
65+ # No NPM_TOKEN needed - OIDC handles authentication!
0 commit comments