diff --git a/.github/workflows/release-alpha-v6.yml b/.github/workflows/release-alpha-v6.yml new file mode 100644 index 00000000000..203346e4731 --- /dev/null +++ b/.github/workflows/release-alpha-v6.yml @@ -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 } + }) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a5ebbf2d695..cf8db97c29e 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -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 @@ -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 @@ -145,5 +154,5 @@ jobs: uses: ./.github/actions/init with: node-version: ${{ matrix.version }} - turbo-team: '' - turbo-token: '' + turbo-team: "" + turbo-token: "" diff --git a/canary-core3-branch b/canary-core3-branch new file mode 100644 index 00000000000..9dfa0b10923 --- /dev/null +++ b/canary-core3-branch @@ -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. + diff --git a/package.json b/package.json index 19c8b9b0abc..53a783a6737 100644 --- a/package.json +++ b/package.json @@ -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%}", @@ -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" }, diff --git a/scripts/canary-core3.mjs b/scripts/canary-core3.mjs new file mode 100755 index 00000000000..0760d213ac3 --- /dev/null +++ b/scripts/canary-core3.mjs @@ -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'); +} diff --git a/scripts/canary.mjs b/scripts/canary.mjs index 54e2b062478..5b431862689 100755 --- a/scripts/canary.mjs +++ b/scripts/canary.mjs @@ -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 diff --git a/scripts/snapshot.mjs b/scripts/snapshot.mjs index fc61227a69d..138c77b7ea3 100755 --- a/scripts/snapshot.mjs +++ b/scripts/snapshot.mjs @@ -10,7 +10,7 @@ const packageEntries = packageNames.map(name => `'${name}': patch`).join('\n'); const snapshot = `--- ${packageEntries} --- - + Snapshot release `;