|
1 | 1 | name: Release |
2 | 2 | on: |
3 | 3 | push: |
4 | | - branches: |
5 | | - - 'main' |
6 | | - - 'next_major' |
| 4 | + |
| 5 | +concurrency: |
| 6 | + group: ${{ github.workflow }}-${{ github.ref }} |
| 7 | + cancel-in-progress: true |
| 8 | + |
| 9 | +permissions: |
| 10 | + id-token: write # Required for OIDC |
| 11 | + contents: read |
| 12 | + checks: write |
| 13 | + statuses: write |
| 14 | + |
7 | 15 | jobs: |
8 | | - release: |
9 | | - name: Final |
10 | | - if: ${{ github.repository == 'primer/css' }} |
| 16 | + release-main: |
| 17 | + name: Main |
| 18 | + if: ${{ github.repository == 'primer/css' && github.ref_name == 'main' }} |
11 | 19 |
|
12 | 20 | runs-on: ubuntu-latest |
13 | 21 | steps: |
|
19 | 27 | persist-credentials: false |
20 | 28 |
|
21 | 29 | - name: Set up Node.js |
22 | | - uses: actions/setup-node@v5 |
| 30 | + uses: actions/setup-node@v6 |
23 | 31 | with: |
24 | | - node-version: 18.x |
| 32 | + node-version: 24 |
25 | 33 | cache: 'npm' |
26 | 34 |
|
27 | 35 | - name: Install dependencies |
|
45 | 53 | publish: npm run release |
46 | 54 | env: |
47 | 55 | GITHUB_TOKEN: ${{ steps.get-access-token.outputs.access-token }} |
48 | | - NPM_TOKEN: ${{ secrets.NPM_AUTH_TOKEN_SHARED }} |
| 56 | + |
| 57 | + release-candidate: |
| 58 | + name: Candidate |
| 59 | + if: ${{ github.repository == 'primer/css' && github.ref_name == 'changeset-release/main' }} |
| 60 | + |
| 61 | + runs-on: ubuntu-latest |
| 62 | + steps: |
| 63 | + - name: Checkout repository |
| 64 | + uses: actions/checkout@v5 |
| 65 | + with: |
| 66 | + # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits |
| 67 | + fetch-depth: 0 |
| 68 | + |
| 69 | + - name: Set up Node.js |
| 70 | + uses: actions/setup-node@v6 |
| 71 | + with: |
| 72 | + node-version: 24 |
| 73 | + cache: 'npm' |
| 74 | + |
| 75 | + - name: Install dependencies |
| 76 | + run: npm ci |
| 77 | + |
| 78 | + - name: Publish release candidate |
| 79 | + run: | |
| 80 | + version=$(jq -r .version package.json) |
| 81 | + echo "$( jq ".version = \"$(echo $version)-rc.$(git rev-parse --short HEAD)\"" package.json )" > package.json |
| 82 | + npm publish --tag next |
| 83 | + env: |
| 84 | + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |
| 85 | + |
| 86 | + - name: Output candidate version number |
| 87 | + uses: actions/github-script@v8 |
| 88 | + with: |
| 89 | + script: | |
| 90 | + const package = require(`${process.env.GITHUB_WORKSPACE}/package.json`) |
| 91 | + github.rest.repos.createCommitStatus({ |
| 92 | + owner: context.repo.owner, |
| 93 | + repo: context.repo.repo, |
| 94 | + sha: context.sha, |
| 95 | + state: 'success', |
| 96 | + context: `Published ${package.name}`, |
| 97 | + description: package.version, |
| 98 | + target_url: `https://unpkg.com/${package.name}@${package.version}/` |
| 99 | + }) |
| 100 | +
|
| 101 | + - name: Upload versions json file |
| 102 | + uses: primer/.github/.github/actions/upload-versions@main |
| 103 | + |
| 104 | + release-canary: |
| 105 | + name: Canary |
| 106 | + if: ${{ github.repository == 'primer/css' && github.ref_name != 'main' && github.ref_name != 'changeset-release/main' }} |
| 107 | + uses: primer/.github/.github/workflows/release_canary.yml@v2.2.1 |
| 108 | + with: |
| 109 | + install: npm ci |
| 110 | + secrets: |
| 111 | + gh_token: ${{ secrets.GITHUB_TOKEN }} |
| 112 | + npm_token: ${{ secrets.NPM_AUTH_TOKEN_SHARED }} |
0 commit comments