11name : Release
22on :
33 push :
4- branches :
5- - ' main'
6- - ' next_major'
4+
75jobs :
8- release :
9- name : Final
10- if : ${{ github.repository == 'primer/doctocat' }}
6+ release-main :
7+ name : Main
8+ if : ${{ github.repository == 'primer/doctocat' && github.ref_name == 'main' }}
119
1210 runs-on : ubuntu-latest
1311 steps :
@@ -21,19 +19,64 @@ jobs:
2119 - name : Set up Node.js
2220 uses : actions/setup-node@v6
2321 with :
24- node-version : 18
22+ node-version : 24
2523 cache : ' npm'
2624
2725 - name : Install dependencies
2826 run : npm ci
2927
3028 - name : Create release pull request or publish to npm
3129 id : changesets
32- uses : changesets/action@master
30+ uses : changesets/action@v1
3331 with :
3432 title : Release Tracking
3533 # This expects you to have a script called release which does a build for your packages and calls changeset publish
3634 publish : npm run release
3735 env :
3836 GITHUB_TOKEN : ${{ secrets.GPR_AUTH_TOKEN_SHARED }}
39- NPM_TOKEN : ${{ secrets.NPM_AUTH_TOKEN_SHARED }}
37+
38+ release-canary :
39+ name : Canary
40+ if : ${{ github.repository == 'primer/doctocat' && github.ref_name != 'main' && github.ref_name != 'changeset-release/main' }}
41+
42+ runs-on : ubuntu-latest
43+ steps :
44+ - name : Checkout repository
45+ uses : actions/checkout@v4
46+ with :
47+ # This makes Actions fetch all Git history so that Changesets can generate changelogs with the correct commits
48+ fetch-depth : 0
49+
50+ - name : Set up Node.js
51+ uses : actions/setup-node@v6
52+ with :
53+ node-version : 24
54+ cache : ' npm'
55+
56+ - name : Install dependencies
57+ run : npm ci
58+
59+ - name : Publish canary version
60+ run : |
61+ echo "$( jq '.version = "0.0.0"' package.json )" > package.json
62+ echo -e "---\n'@primer/gatsby-theme-doctocat': patch\n---\n\nFake entry to force publishing" > .changeset/force-snapshot-release.md
63+ rm -f .changeset/pre.json
64+ npx changeset version --snapshot
65+ npx changeset publish --tag canary
66+ env :
67+ GITHUB_TOKEN : ${{ secrets.GITHUB_TOKEN }}
68+
69+ - name : Output canary version number
70+ uses : actions/github-script@v8
71+ with :
72+ script : |
73+ const package = require(`${process.env.GITHUB_WORKSPACE}/theme/package.json`)
74+ github.rest.repos.createCommitStatus({
75+ owner: context.repo.owner,
76+ repo: context.repo.repo,
77+ sha: context.sha,
78+ state: 'success',
79+ context: `Published ${package.name}`,
80+ description: package.version,
81+ target_url: `https://unpkg.com/${package.name}@${package.version}/`
82+ })
0 commit comments