Skip to content

Merge pull request #21 from NikolaiKushner/changeset-release/main #10

Merge pull request #21 from NikolaiKushner/changeset-release/main

Merge pull request #21 from NikolaiKushner/changeset-release/main #10

Workflow file for this run

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
# Story tests run in a real browser, so the binary has to be present.
# Without this the storybook project fails to launch and `pnpm test`
# reports every unit test green alongside one unhandled error.
- name: Install Playwright Chromium
run: pnpm exec playwright install --with-deps chromium
- 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
# One GitHub Release per published package, with the changelog as its
# body — so the repository's Releases tab shows what shipped without
# anyone writing it out by hand.
createGithubReleases: true
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}