Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
73 changes: 73 additions & 0 deletions .github/workflows/release-alpha-v6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,73 @@
name: canary-core3 release
run-name: canary-core3 release from ${{ github.ref_name }}

on:
push:
branches:
- main

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
cancel-in-progress: true

jobs:
canary-core3-release:
if: ${{ github.repository == 'clerk/javascript' }}
runs-on: ${{ vars.RUNNER_NORMAL || 'ubuntu-latest' }}
timeout-minutes: ${{ vars.TIMEOUT_MINUTES_NORMAL && fromJSON(vars.TIMEOUT_MINUTES_NORMAL) || 10 }}
env:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_CACHE: remote:rw
permissions:
contents: read
id-token: write
steps:
- name: Checkout repo
uses: actions/checkout@v4

- name: Setup
id: config
uses: ./.github/actions/init
with:
turbo-signature: ${{ secrets.TURBO_REMOTE_CACHE_SIGNATURE_KEY }}
turbo-team: ${{ vars.TURBO_TEAM }}
turbo-token: ${{ secrets.TURBO_TOKEN }}
playwright-enabled: true # Must be present to enable caching on branched workflows
registry-url: "https://registry.npmjs.org"

- name: Version packages for canary-core3
id: version-packages
run: pnpm version-packages:canary-core3 | tail -1 >> "$GITHUB_OUTPUT"

- name: Build release
if: steps.version-packages.outputs.success == '1'
run: pnpm turbo build $TURBO_ARGS

- name: canary-core3 release
if: steps.version-packages.outputs.success == '1'
run: pnpm release:canary-core3
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true

- name: Trigger workflows on related repos
if: steps.version-packages.outputs.success == '1'
uses: actions/github-script@v7
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 clerkUiVersion = require('./packages/ui/package.json').version;
const nextjsVersion = require('./packages/nextjs/package.json').version;

github.rest.actions.createWorkflowDispatch({
owner: 'clerk',
repo: 'sdk-infra-workers',
workflow_id: 'update-pkg-versions.yml',
ref: 'main',
inputs: { clerkjsVersion, clerkUiVersion }
})
17 changes: 13 additions & 4 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,15 @@ jobs:
fetch-depth: 0
show-progress: false

- name: Safety check - Prevent production releases on canary-core3 branch
run: |
if [ -f ".canary-core3-branch" ]; then
echo "❌ ERROR: This branch is marked for canary-core3 releases only!"
echo "Production releases (latest tag) are not allowed on this branch."
echo "If you need to make a production release, use the main production branch."
exit 1
fi

- name: Setup
id: config
uses: ./.github/actions/init
Expand All @@ -55,8 +64,8 @@ jobs:
id: changesets
uses: changesets/action@v1
with:
commit: 'ci(repo): Version packages'
title: 'ci(repo): Version packages'
commit: "ci(repo): Version packages"
title: "ci(repo): Version packages"
publish: pnpm release
# Workaround for https://github.com/changesets/changesets/issues/421
version: pnpm version-packages
Expand Down Expand Up @@ -145,5 +154,5 @@ jobs:
uses: ./.github/actions/init
with:
node-version: ${{ matrix.version }}
turbo-team: ''
turbo-token: ''
turbo-team: ""
turbo-token: ""
5 changes: 5 additions & 0 deletions canary-core3-branch
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Alpha v6 Development Branch
# This file marks this branch as an canary-core3 development branch.
# Production releases (latest tag) are disabled on this branch.
# Only canary-core3 releases are allowed.

2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
"prepare": "husky install",
"release": "changeset publish && git push --follow-tags",
"release:canary": "changeset publish --tag canary --no-git-tag",
"release:canary-core3": "changeset publish --tag canary-core3 --no-git-tag",
"release:snapshot": "changeset publish --tag snapshot --no-git-tag",
"release:verdaccio": "if [ \"$(npm config get registry)\" = \"https://registry.npmjs.org/\" ]; then echo 'Error: Using default registry' && exit 1; else TURBO_CONCURRENCY=1 pnpm build && changeset publish --no-git-tag; fi",
"test": "FORCE_COLOR=1 turbo test --concurrency=${TURBO_CONCURRENCY:-80%}",
Expand Down Expand Up @@ -59,6 +60,7 @@
"typedoc:generate:skip-build": "typedoc --tsconfig tsconfig.typedoc.json && node .typedoc/extract-returns-and-params.mjs && rimraf .typedoc/docs && cpy '.typedoc/temp-docs/**' '.typedoc/docs' && rimraf .typedoc/temp-docs",
"version-packages": "changeset version && pnpm install --lockfile-only --engine-strict=false",
"version-packages:canary": "./scripts/canary.mjs",
"version-packages:canary-core3": "./scripts/canary-core3.mjs",
"version-packages:snapshot": "./scripts/snapshot.mjs",
"yalc:all": "for d in packages/*/; do echo $d; cd $d; pnpm yalc push --replace --sig; cd '../../'; done"
},
Expand Down
42 changes: 42 additions & 0 deletions scripts/canary-core3.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
#!/usr/bin/env zx

import { $, echo } from 'zx';

import { constants, getPackageNames } from './common.mjs';

const packageNames = await getPackageNames();
const packageEntries = packageNames.map(name => `'${name}': patch`).join('\n');

const snapshot = `---
${packageEntries}
---

canary-core3 release
`;

await $`pnpm dlx json -I -f ${constants.ChangesetConfigFile} -e "this.changelog = false"`;

try {
// exit pre-release mode if we're in it
await $`pnpm changeset pre exit`;
// bump the version of all affected packages
// this will remove the prerelease versions
// but will also clear the changeset .md files
await $`pnpm changeset version`;
// generate a temp .md file that indicates that all packages have changes
// in order to force a snapshot release
await $`touch .changeset/snap.md && echo ${snapshot} > .changeset/snap.md`;
} catch {
// otherwise, do nothing
}

const res = await $`pnpm changeset version --snapshot canary-core3`;
const success = !res.stderr.includes('No unreleased changesets found');

await $`git checkout HEAD -- ${constants.ChangesetConfigFile}`;

if (success) {
echo('success=1');
} else {
echo('success=0');
}
20 changes: 5 additions & 15 deletions scripts/canary.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -2,23 +2,13 @@

import { $, echo } from 'zx';

import { constants } from './common.mjs';
import { constants, getPackageNames } from './common.mjs';

const packageNames = await getPackageNames();
const packageEntries = packageNames.map(name => `'${name}': patch`).join('\n');

const snapshot = `---
'@clerk/chrome-extension': patch
'@clerk/localizations': patch
'@clerk/clerk-js': patch
'@clerk/backend': patch
'@clerk/fastify': patch
'@clerk/agent-toolkit': patch
'@clerk/nextjs': patch
'@clerk/shared': patch
'@clerk/themes': patch
'@clerk/react': patch
'@clerk/expo': patch
'@clerk/express': patch
'@clerk/testing': patch
'@clerk/elements': patch
${packageEntries}
---

Canary release
Expand Down
2 changes: 1 addition & 1 deletion scripts/snapshot.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ const packageEntries = packageNames.map(name => `'${name}': patch`).join('\n');
const snapshot = `---
${packageEntries}
---

Snapshot release
`;

Expand Down
Loading