Skip to content

Commit 71c1550

Browse files
amannnclaude
andcommitted
ci: combine stable and canary release workflows into one file
npm Trusted Publishing can only be configured against a single workflow file, so merge `prerelease-canary.yml` into `release.yml` as two branch-gated jobs: - `stable` runs on `main` and publishes the `latest` dist-tag - `canary` runs on `canary` and publishes the `canary` dist-tag Only the job matching the pushed branch runs (`if: github.ref == …`). The canary job now publishes via Trusted Publishing as well, dropping the `NPM_TOKEN` / `NODE_AUTH_TOKEN` to match the stable job. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
1 parent 30d1004 commit 71c1550

2 files changed

Lines changed: 41 additions & 40 deletions

File tree

.github/workflows/prerelease-canary.yml

Lines changed: 0 additions & 37 deletions
This file was deleted.

.github/workflows/release.yml

Lines changed: 41 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,18 @@
11
name: release
22

3+
# A single workflow file so npm Trusted Publishing can be configured against it.
4+
# The branch determines which release runs: `main` → stable (latest), `canary`
5+
# → prerelease (canary). Only the job matching the pushed branch runs.
36
on:
47
push:
58
branches:
69
- main
10+
- canary
711

812
jobs:
9-
main:
13+
stable:
14+
name: stable (latest)
15+
if: github.ref == 'refs/heads/main'
1016
runs-on: ubuntu-latest
1117
permissions:
1218
contents: write
@@ -16,9 +22,9 @@ jobs:
1622
- uses: pnpm/action-setup@v4
1723
- uses: actions/setup-node@v4
1824
with:
19-
cache: "pnpm"
25+
cache: 'pnpm'
2026
node-version: 20.x
21-
registry-url: "https://registry.npmjs.org"
27+
registry-url: 'https://registry.npmjs.org'
2228
- run: npm install -g npm@latest # Trusted publishers
2329
- run: pnpm install
2430
- run: |
@@ -29,3 +35,35 @@ jobs:
2935
env:
3036
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
3137
# No NODE_AUTH_TOKEN since we use Trusted Publishers
38+
39+
canary:
40+
name: prerelease (canary)
41+
if: github.ref == 'refs/heads/canary'
42+
runs-on: ubuntu-latest
43+
permissions:
44+
contents: write
45+
id-token: write
46+
steps:
47+
- uses: actions/checkout@v4
48+
- uses: pnpm/action-setup@v4
49+
- uses: actions/setup-node@v4
50+
with:
51+
cache: 'pnpm'
52+
node-version: 20.x
53+
registry-url: 'https://registry.npmjs.org'
54+
- run: npm install -g npm@latest # Trusted publishers
55+
- run: pnpm install
56+
- run: pnpm turbo run build --filter './packages/**'
57+
- run: |
58+
git config --global user.name "${{ github.actor }}"
59+
git config --global user.email "${{ github.actor }}@users.noreply.github.com"
60+
# Change workspace dependencies from "workspace:^" to "workspace:"
61+
- run: |
62+
sed -i 's/"use-intl": "workspace:\^"/"use-intl": "workspace:"/' ./packages/next-intl/package.json && \
63+
sed -i 's/"next-intl-swc-plugin-extractor": "workspace:\^"/"next-intl-swc-plugin-extractor": "workspace:"/' ./packages/next-intl/package.json && \
64+
git commit -am "use fixed version"
65+
- run: pnpm lerna publish 0.0.0-canary-${GITHUB_SHA::7} --no-git-reset --dist-tag canary --no-push --yes
66+
if: "${{startsWith(github.event.head_commit.message, 'fix: ') || startsWith(github.event.head_commit.message, 'feat: ') || startsWith(github.event.head_commit.message, 'feat!: ')}}"
67+
env:
68+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
69+
# No NODE_AUTH_TOKEN since we use Trusted Publishers

0 commit comments

Comments
 (0)