Skip to content

Commit 5ee35f0

Browse files
committed
chore(repo): Introduce canary releases from main
The main branch will produce canary releases until the next major version is ready for release. To produce a staging and production release, open a PR from the clerk-v4 branch.
1 parent 22b8126 commit 5ee35f0

File tree

4 files changed

+90
-0
lines changed

4 files changed

+90
-0
lines changed

Diff for: .changeset/red-monkeys-sing.md

+2
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
---
2+
---

Diff for: .github/workflows/release-canary.yml

+69
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,69 @@
1+
name: Canary release
2+
run-name: Canary release from ${{ github.ref_name }}
3+
4+
on:
5+
push:
6+
branches:
7+
- main
8+
9+
concurrency:
10+
group: ${{ github.workflow }}-${{ github.ref }}
11+
cancel-in-progress: true
12+
13+
jobs:
14+
canary-release:
15+
if: ${{ github.repository == 'clerkinc/javascript' }}
16+
runs-on: ubuntu-latest
17+
env:
18+
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
19+
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
20+
TURBO_REMOTE_ONLY: true
21+
steps:
22+
- name: Checkout repo
23+
uses: actions/checkout@v3
24+
25+
- name: Setup
26+
uses: ./.github/actions/setup
27+
28+
- name: Version packages for canary
29+
id: version-packages
30+
run: npm run version:canary | tail -1 >> "$GITHUB_OUTPUT"
31+
32+
- name: Canary release
33+
if: steps.version-packages.outputs.success == '1'
34+
run: npm run release:canary
35+
env:
36+
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
37+
38+
- name: Trigger workflows on related repos
39+
uses: actions/github-script@v6
40+
with:
41+
result-encoding: string
42+
retries: 3
43+
retry-exempt-status-codes: 400,401
44+
github-token: ${{ secrets.CLERK_COOKIE_PAT }}
45+
script: |
46+
const clerkjsVersion = require('./packages/clerk-js/package.json').version;
47+
const nextjsVersion = require('./packages/nextjs/package.json').version;
48+
49+
if (clerkjsVersion.includes('canary')) {
50+
console.log('clerk-js changed, will notify clerkinc/cloudflare-workers');
51+
github.rest.actions.createWorkflowDispatch({
52+
owner: 'clerkinc',
53+
repo: 'cloudflare-workers',
54+
workflow_id: 'release-canary-clerkjs-proxy.yml',
55+
ref: 'main',
56+
inputs: { version: clerkjsVersion }
57+
})
58+
}
59+
60+
if (nextjsVersion.includes('canary')) {
61+
console.log('clerk/nextjs changed, will notify clerkinc/accounts');
62+
github.rest.actions.createWorkflowDispatch({
63+
owner: 'clerkinc',
64+
repo: 'accounts',
65+
workflow_id: 'release-canary.yml',
66+
ref: 'main',
67+
inputs: { version: nextjsVersion }
68+
})
69+
}

Diff for: package.json

+1
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@
7878
"version": "npx changeset version && ./scripts/version-info.sh",
7979
"version:snapshot": "./scripts/snapshot.mjs",
8080
"version:staging": "./scripts/staging.mjs",
81+
"version:canary": "./scripts/canary.mjs",
8182
"release": "FORCE_COLOR=1 TURBO_CONCURRENCY=4 npm run build -- --force && npm run test && npx changeset publish && git push --follow-tags",
8283
"release:snapshot": "FORCE_COLOR=1 TURBO_CONCURRENCY=4 npm run build && npx changeset publish --tag snapshot --no-git-tag",
8384
"release:staging": "FORCE_COLOR=1 TURBO_CONCURRENCY=4 npm run build && npx changeset publish --tag staging --no-git-tag",

Diff for: scripts/canary.mjs

+18
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
#!/usr/bin/env zx
2+
3+
import 'zx/globals';
4+
5+
import { constants } from './common.mjs';
6+
7+
await $`npx json -I -f ${constants.ChangesetConfigFile} -e "this.changelog = false"`;
8+
9+
const res = await $`npx changeset version --snapshot canary`;
10+
const success = !res.stderr.includes('No unreleased changesets found');
11+
12+
await $`git checkout HEAD -- ${constants.ChangesetConfigFile}`;
13+
14+
if (success) {
15+
echo('success=1');
16+
} else {
17+
echo('success=0');
18+
}

0 commit comments

Comments
 (0)