add changeset #899
Workflow file for this run
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: | |
| push: | |
| # Ignore merge queue branches (matches primer/react configuration) | |
| branches-ignore: | |
| - 'gh-readonly-queue/**' | |
| tags-ignore: | |
| - '**' | |
| workflow_dispatch: | |
| concurrency: | |
| group: ${{ github.workflow }}-${{ github.ref }} | |
| cancel-in-progress: true | |
| permissions: | |
| id-token: write # Required for OIDC | |
| contents: write | |
| pull-requests: write | |
| checks: write | |
| statuses: write | |
| jobs: | |
| release-main: | |
| if: github.ref_name == 'main' | |
| name: Main | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Set up Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: npm ci | |
| - uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.PRIMER_APP_ID_SHARED }} | |
| private-key: ${{ secrets.PRIMER_APP_PRIVATE_KEY_SHARED }} | |
| - name: Build | |
| run: npm run build:lib | |
| - name: Create release pull request or publish to npm | |
| id: changesets | |
| # Uses SHA for security hardening | |
| # Please keep this up-to-date if you're changing the SHA below | |
| uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba | |
| with: | |
| title: Release tracking | |
| publish: npm run release | |
| env: | |
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
| release-next-minor: | |
| if: github.ref_name == 'next-minor' | |
| name: Next minor | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Set up Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: npm ci | |
| - uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.PRIMER_APP_ID_SHARED }} | |
| private-key: ${{ secrets.PRIMER_APP_PRIVATE_KEY_SHARED }} | |
| - name: Build | |
| run: npm run build:lib | |
| - name: Create release pull request or publish to npm | |
| id: changesets | |
| # Uses SHA for security hardening | |
| # Please keep this up-to-date if you're changing the SHA below | |
| uses: changesets/action@e0145edc7d9d8679003495b11f87bd8ef63c0cba | |
| with: | |
| title: Release tracking (next minor) | |
| publish: npm run release | |
| env: | |
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
| release-candidate: | |
| if: github.ref_name == 'changeset-release/main' | |
| name: Candidate | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: npm ci | |
| - name: Build | |
| run: npm run build:lib | |
| - name: Publish release candidate | |
| run: | | |
| npm exec --workspaces -- ../../packages/repo-configs/scripts/prepare-release-candidate | |
| npx changeset publish --tag next | |
| env: | |
| GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Output release candidate version | |
| uses: actions/[email protected] | |
| with: | |
| script: | | |
| const paths = ['react', 'design-tokens', 'css'].forEach((path) => { | |
| const package = require(`${process.env.GITHUB_WORKSPACE}/packages/${path}/package.json`) | |
| github.repos.createCommitStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| sha: context.sha, | |
| state: 'success', | |
| context: `Published ${package.name}`, | |
| description: package.version, | |
| target_url: `https://unpkg.com/${package.name}@${package.version}/` | |
| }) | |
| }) | |
| release-candidate-next-minor: | |
| if: github.ref_name == 'changeset-release/next-minor' | |
| name: Next minor candidate (@next-minor) | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits | |
| fetch-depth: 0 | |
| - name: Set up Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: npm ci | |
| - uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.PRIMER_APP_ID_SHARED }} | |
| private-key: ${{ secrets.PRIMER_APP_PRIVATE_KEY_SHARED }} | |
| - name: Build | |
| run: npm run build:lib | |
| - name: Publish release candidate | |
| run: | | |
| npm exec --workspaces -- ../../packages/repo-configs/scripts/prepare-release-candidate | |
| npx changeset publish --tag next-minor | |
| env: | |
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
| - name: Output canary version | |
| uses: actions/[email protected] | |
| with: | |
| script: | | |
| const paths = ['react', 'design-tokens', 'css'].forEach((path) => { | |
| const package = require(`${process.env.GITHUB_WORKSPACE}/packages/${path}/package.json`) | |
| github.repos.createCommitStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| sha: context.sha, | |
| state: 'success', | |
| context: `Published ${package.name}`, | |
| description: package.version, | |
| target_url: `https://unpkg.com/${package.name}@${package.version}/` | |
| }) | |
| }) | |
| release-canary: | |
| if: github.ref_name != 'main' && github.ref_name != 'next-minor' && github.ref_name != 'changeset-release/main' && github.ref_name != 'changeset-release/next-minor' | |
| name: Canary | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits | |
| fetch-depth: 0 | |
| persist-credentials: false | |
| - name: Set up Node | |
| uses: actions/setup-node@v6 | |
| with: | |
| node-version: 24 | |
| - name: Install dependencies | |
| run: npm ci | |
| - uses: actions/create-github-app-token@67018539274d69449ef7c02e8e71183d1719ab42 | |
| id: app-token | |
| with: | |
| app-id: ${{ vars.PRIMER_APP_ID_SHARED }} | |
| private-key: ${{ secrets.PRIMER_APP_PRIVATE_KEY_SHARED }} | |
| - name: Build | |
| run: npm run build:lib | |
| - name: Publish canary release | |
| run: | | |
| npm exec --workspaces -- ../../packages/repo-configs/scripts/prepare-canary | |
| npx changeset publish --tag canary | |
| env: | |
| GITHUB_TOKEN: ${{ steps.app-token.outputs.token }} | |
| - name: Output canary version | |
| uses: actions/[email protected] | |
| with: | |
| script: | | |
| const paths = ['react', 'design-tokens', 'css'].forEach((path) => { | |
| const package = require(`${process.env.GITHUB_WORKSPACE}/packages/${path}/package.json`) | |
| github.repos.createCommitStatus({ | |
| owner: context.repo.owner, | |
| repo: context.repo.repo, | |
| sha: context.sha, | |
| state: 'success', | |
| context: `Published ${package.name}`, | |
| description: package.version, | |
| target_url: `https://unpkg.com/${package.name}@${package.version}/` | |
| }) | |
| }) |