Skip to content
Closed
Show file tree
Hide file tree
Changes from 1 commit
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
5 changes: 5 additions & 0 deletions .alpha-v6-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 alpha-v6 development branch.
# Production releases (latest tag) are disabled on this branch.
# Only alpha-v6 releases are allowed.

83 changes: 83 additions & 0 deletions .github/workflows/release-alpha-v6.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
name: Alpha-v6 release
run-name: Alpha-v6 release from ${{ github.ref_name }}

on:
push:
branches:
- main
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- main
- main
- vincent-and-the-doctor


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

jobs:
alpha-v6-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 alpha-v6
id: version-packages
run: pnpm version-packages:alpha-v6 | tail -1 >> "$GITHUB_OUTPUT"

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

- name: Alpha-v6 release
if: steps.version-packages.outputs.success == '1'
run: pnpm release:alpha-v6
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 nextjsVersion = require('./packages/nextjs/package.json').version;

github.rest.actions.createWorkflowDispatch({
owner: 'clerk',
repo: 'sdk-infra-workers',
workflow_id: 'update-clerkjs.yml',
ref: 'main',
inputs: { version: clerkjsVersion }
})

# if (nextjsVersion.includes('alpha-v6')) {
# console.log('clerk/nextjs changed with alpha-v6, will notify clerk/accounts');
# github.rest.actions.createWorkflowDispatch({
# owner: 'clerk',
# repo: 'accounts',
# workflow_id: 'release-staging.yml',
# ref: 'main',
# inputs: { version: nextjsVersion }
# })
# }
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 alpha-v6 branch
run: |
if [ -f ".alpha-v6-branch" ]; then
echo "❌ ERROR: This branch is marked for alpha-v6 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: ""
2 changes: 2 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -25,6 +25,7 @@
"nuke": "node ./scripts/nuke.mjs",
"prepare": "husky install",
"release": "changeset publish && git push --follow-tags",
"release:alpha-v6": "changeset publish --tag alpha-v6 --no-git-tag",
"release:canary": "changeset publish --tag canary --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",
Expand Down Expand Up @@ -58,6 +59,7 @@
"typedoc:generate": "pnpm build && pnpm typedoc:generate:skip-build",
"typedoc:generate:skip-build": "typedoc --tsconfig tsconfig.typedoc.json && rm -rf .typedoc/docs && mv .typedoc/temp-docs .typedoc/docs",
"version-packages": "changeset version && pnpm install --lockfile-only --engine-strict=false",
"version-packages:alpha-v6": "./scripts/alpha-v6.mjs",
"version-packages:canary": "./scripts/canary.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
43 changes: 43 additions & 0 deletions scripts/alpha-v6.mjs
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#!/usr/bin/env zx

import { $, echo } from 'zx';

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

const snapshot = `---
'@clerk/backend': patch
'@clerk/shared': patch
'@clerk/react': patch
'@clerk/clerk-js': patch
'@clerk/nextjs': patch
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
'@clerk/nextjs': patch
'@clerk/nextjs': patch
'@clerk/expo': patch

---

Alpha-v6 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 alpha-v6`;
const success = !res.stderr.includes('No unreleased changesets found');

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

if (success) {
echo('success=1');
} else {
echo('success=0');
}
Loading