Release #18
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Release | |
| on: | |
| workflow_run: | |
| workflows: | |
| - CI | |
| types: | |
| - completed | |
| branches: | |
| - master | |
| workflow_dispatch: | |
| concurrency: ${{ github.workflow }}-${{ github.ref }} | |
| permissions: | |
| contents: write | |
| id-token: write | |
| pull-requests: write | |
| jobs: | |
| release: | |
| name: Version or publish packages | |
| runs-on: ubuntu-latest | |
| if: github.event_name == 'workflow_dispatch' || github.event.workflow_run.conclusion == 'success' | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v6 | |
| with: | |
| fetch-depth: 0 | |
| ref: ${{ github.event.workflow_run.head_sha || github.sha }} | |
| - name: Attach workflow run branch | |
| if: github.event_name == 'workflow_run' | |
| run: git switch --force-create "${{ github.event.workflow_run.head_branch }}" "${{ github.event.workflow_run.head_sha }}" | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| registry-url: https://registry.npmjs.org | |
| package-manager-cache: false | |
| - name: Setup pnpm | |
| run: | | |
| corepack enable | |
| corepack prepare pnpm@11.1.3 --activate | |
| - name: Install dependencies | |
| run: pnpm install --frozen-lockfile | |
| - name: Detect pending changesets | |
| id: pending-changesets | |
| run: | | |
| if find .changeset -maxdepth 1 -type f -name '*.md' ! -name 'README.md' | grep -q .; then | |
| echo "found=true" >> "$GITHUB_OUTPUT" | |
| else | |
| echo "found=false" >> "$GITHUB_OUTPUT" | |
| fi | |
| - name: Audit release plan | |
| if: steps.pending-changesets.outputs.found == 'true' | |
| run: pnpm -w run release:audit | |
| - name: Verify npm trusted publishing toolchain | |
| run: | | |
| set -euo pipefail | |
| node --version | |
| npm --version | |
| pnpm --version | |
| - name: Create version PR or publish packages | |
| id: changesets | |
| uses: changesets/action@v1 | |
| with: | |
| version: pnpm -w run changeset:version | |
| publish: pnpm -w run changeset:publish | |
| commit: 'release: version packages' | |
| title: 'release: version packages' | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Create repository release baseline tag | |
| if: steps.changesets.outputs.published == 'true' | |
| env: | |
| PUBLISHED_PACKAGES: ${{ steps.changesets.outputs.publishedPackages }} | |
| run: | | |
| set -euo pipefail | |
| tag="$(node ./scripts/resolve-release-baseline-tag.mjs)" | |
| if [ -z "$tag" ]; then | |
| echo "No published package versions were reported; skipping repository baseline tag." | |
| exit 0 | |
| fi | |
| git fetch --tags --force | |
| if git rev-parse "$tag" >/dev/null 2>&1; then | |
| echo "Tag $tag already exists; skipping." | |
| exit 0 | |
| fi | |
| git tag "$tag" | |
| git push origin "$tag" |