Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
59 changes: 59 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,59 @@
name: Release

on:
push:
branches: [main]

# One release at a time. Two overlapping runs would race on the version bump.
concurrency: release-${{ github.ref }}

permissions:
contents: write # changesets commits version bumps and pushes tags
pull-requests: write # changesets opens and updates the "Version Packages" PR
id-token: write # OIDC — this is what replaces a long-lived npm token

jobs:
release:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v7
with:
# Changesets needs the history to work out what has already shipped.
fetch-depth: 0

- uses: pnpm/action-setup@v6

- uses: actions/setup-node@v7
with:
node-version-file: .nvmrc
cache: pnpm
registry-url: https://registry.npmjs.org

# Trusted publishing needs npm 11.5.1+; the runner's bundled npm is older.
- run: npm install -g npm@latest

- run: pnpm install --frozen-lockfile

# Build first: the workspace packages resolve through dist, so lint,
# typecheck and test all fail confusingly against an unbuilt tree.
- run: pnpm build
- run: pnpm lint
- run: pnpm typecheck
- run: pnpm test
- run: pnpm size

# Generated files are generated. If either has drifted the release would
# ship documentation that disagrees with the code it describes.
- run: pnpm docs:props && pnpm docs:agents
- name: Fail if generated docs are stale
run: git diff --exit-code || (echo "::error::Run pnpm docs:props and pnpm docs:agents, then commit" && exit 1)

- name: Create release PR or publish
uses: changesets/action@v1
with:
# While unreleased changesets exist this opens or updates the
# "Version Packages" PR. Merging that PR triggers the run that
# actually publishes, so a release is always a deliberate merge.
publish: pnpm changeset publish
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}