-
Notifications
You must be signed in to change notification settings - Fork 279
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
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.
- Loading branch information
Showing
3 changed files
with
88 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,69 @@ | ||
name: Canary release | ||
run-name: Canary release from ${{ github.ref_name }} | ||
|
||
on: | ||
push: | ||
branches: | ||
- main | ||
|
||
concurrency: | ||
group: ${{ github.workflow }}-${{ github.ref }} | ||
cancel-in-progress: true | ||
|
||
jobs: | ||
canary-release: | ||
if: ${{ github.repository == 'clerkinc/javascript' }} | ||
runs-on: ubuntu-latest | ||
env: | ||
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }} | ||
TURBO_TEAM: ${{ vars.TURBO_TEAM }} | ||
TURBO_REMOTE_ONLY: true | ||
steps: | ||
- name: Checkout repo | ||
uses: actions/checkout@v3 | ||
|
||
- name: Setup | ||
uses: ./.github/actions/setup | ||
|
||
- name: Version packages for canary | ||
id: version-packages | ||
run: npm run version:canary | tail -1 >> "$GITHUB_OUTPUT" | ||
|
||
- name: Canary release | ||
if: steps.version-packages.outputs.success == '1' | ||
run: npm run release:canary | ||
env: | ||
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} | ||
|
||
- name: Trigger workflows on related repos | ||
uses: actions/github-script@v6 | ||
with: | ||
result-encoding: string | ||
retries: 3 | ||
retry-exempt-status-codes: 400,401 | ||
github-token: ${{ secrets.CLERK_COOKIE_PAT }} | ||
script: | | ||
const clerkjsVersion = require('./packages/clerk-js/package.json').version; | ||
const nextjsVersion = require('./packages/nextjs/package.json').version; | ||
if (clerkjsVersion.includes('canary')) { | ||
console.log('clerk-js changed, will notify clerkinc/cloudflare-workers'); | ||
github.rest.actions.createWorkflowDispatch({ | ||
owner: 'clerkinc', | ||
repo: 'cloudflare-workers', | ||
workflow_id: 'release-canary-clerkjs-proxy.yml', | ||
ref: 'main', | ||
inputs: { version: clerkjsVersion } | ||
}) | ||
} | ||
if (nextjsVersion.includes('canary')) { | ||
console.log('clerk/nextjs changed, will notify clerkinc/accounts'); | ||
github.rest.actions.createWorkflowDispatch({ | ||
owner: 'clerkinc', | ||
repo: 'accounts', | ||
workflow_id: 'release-canary.yml', | ||
ref: 'main', | ||
inputs: { version: nextjsVersion } | ||
}) | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
#!/usr/bin/env zx | ||
|
||
import 'zx/globals'; | ||
|
||
import { constants } from './common.mjs'; | ||
|
||
await $`npx json -I -f ${constants.ChangesetConfigFile} -e "this.changelog = false"`; | ||
|
||
const res = await $`npx changeset version --snapshot canary`; | ||
const success = !res.stderr.includes('No unreleased changesets found'); | ||
|
||
await $`git checkout HEAD -- ${constants.ChangesetConfigFile}`; | ||
|
||
if (success) { | ||
echo('success=1'); | ||
} else { | ||
echo('success=0'); | ||
} |