11name : Release
22on :
33 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+
715jobs :
8- release :
9- name : Final
10- if : ${{ github.repository == 'primer/doctocat' }}
16+ release-main :
17+ name : Main
18+ if : ${{ github.repository == 'primer/doctocat' && github.ref_name == 'main' }}
1119
1220 runs-on : ubuntu-latest
1321 steps :
@@ -19,21 +27,66 @@ jobs:
1927 persist-credentials : false
2028
2129 - name : Set up Node.js
22- uses : actions/setup-node@v4
30+ uses : actions/setup-node@v6
2331 with :
24- node-version : 18
32+ node-version : 24
2533 cache : ' npm'
2634
2735 - name : Install dependencies
2836 run : npm ci
2937
3038 - name : Create release pull request or publish to npm
3139 id : changesets
32- uses : changesets/action@master
40+ uses : changesets/action@v1
3341 with :
3442 title : Release Tracking
3543 # This expects you to have a script called release which does a build for your packages and calls changeset publish
3644 publish : npm run release
3745 env :
3846 GITHUB_TOKEN : ${{ secrets.GPR_AUTH_TOKEN_SHARED }}
39- NPM_TOKEN : ${{ secrets.NPM_AUTH_TOKEN_SHARED }}
47+
48+ release-canary :
49+ name : Canary
50+ if : ${{ github.repository == 'primer/doctocat' && github.ref_name != 'main' && github.ref_name != 'changeset-release/main' }}
51+
52+ runs-on : ubuntu-latest
53+ steps :
54+ - name : Checkout repository
55+ uses : actions/checkout@v4
56+ with :
57+ # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
58+ fetch-depth : 0
59+
60+ - name : Set up Node.js
61+ uses : actions/setup-node@v6
62+ with :
63+ node-version : 24
64+ cache : ' npm'
65+
66+ - name : Install dependencies
67+ run : npm ci
68+
69+ - name : Publish canary version
70+ run : |
71+ echo "$( jq '.version = "0.0.0"' package.json )" > package.json
72+ echo -e "---\n'@primer/gatsby-theme-doctocat': patch\n---\n\nFake entry to force publishing" > .changeset/force-snapshot-release.md
73+ rm -f .changeset/pre.json
74+ npx changeset version --snapshot
75+ npx changeset publish --tag canary
76+ env :
77+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
78+
79+ - name : Output canary version number
80+ uses : actions/github-script@v8
81+ with :
82+ script : |
83+ const package = require(`${process.env.GITHUB_WORKSPACE}/theme/package.json`)
84+ github.rest.repos.createCommitStatus({
85+ owner: context.repo.owner,
86+ repo: context.repo.repo,
87+ sha: context.sha,
88+ state: 'success',
89+ context: `Published ${package.name}`,
90+ description: package.version,
91+ target_url: `https://unpkg.com/${package.name}@${package.version}/`
92+ })
0 commit comments