Skip to content

Commit

Permalink
chore(repo): Backport canary package release into v4 (#2066)
Browse files Browse the repository at this point in the history
  • Loading branch information
anagstef authored Nov 7, 2023
1 parent 4f9214a commit 4c34290
Show file tree
Hide file tree
Showing 13 changed files with 115 additions and 182 deletions.
6 changes: 6 additions & 0 deletions .changeset/curvy-mails-rhyme.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
---
'@clerk/clerk-js': patch
'@clerk/shared': patch
---

Rename the @staging tag to @canary. Drop support for @next tag.
39 changes: 38 additions & 1 deletion .github/workflows/release-canary.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ run-name: Canary release from ${{ github.ref_name }}
on:
push:
branches:
- main
- release/v4

concurrency:
group: ${{ github.workflow }}-${{ github.ref }}
Expand All @@ -18,6 +18,9 @@ jobs:
TURBO_TOKEN: ${{ secrets.TURBO_TOKEN }}
TURBO_TEAM: ${{ vars.TURBO_TEAM }}
TURBO_REMOTE_ONLY: true
permissions:
contents: read
id-token: write
steps:
- name: Checkout repo
uses: actions/checkout@v3
Expand All @@ -34,3 +37,37 @@ jobs:
run: npm run release:canary
env:
NODE_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }}
NPM_CONFIG_PROVENANCE: true

- 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 clerk/cloudflare-workers');
github.rest.actions.createWorkflowDispatch({
owner: 'clerk',
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 clerk/accounts');
github.rest.actions.createWorkflowDispatch({
owner: 'clerk',
repo: 'accounts',
workflow_id: 'release-canary.yml',
ref: 'main',
inputs: { version: nextjsVersion }
})
}
73 changes: 0 additions & 73 deletions .github/workflows/release-staging.yml

This file was deleted.

16 changes: 8 additions & 8 deletions docs/CICD.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,10 +2,10 @@

## TLDR (day-to-day dev flow)

Every time a PR is merged into `main`, an automated staging release will happen. Once the packages are pushed to `npm`, the following actions will take place:
Every time a PR is merged into `main`, an automated canary release will happen. Once the packages are pushed to `npm`, the following actions will take place:

- The staging `clerkjs-proxy` worker will start serving the most recent `@staging` version of `@clerk/clerk-js`, completely bypassing any Cloudflare and JSDeliver edge caches.
- The staging Accounts project will be deployed using the most recent `@staging` version of `@clerk/nextjs`.
- The canary `clerkjs-proxy` worker will start serving the most recent `@canary` version of `@clerk/clerk-js`, completely bypassing any Cloudflare and JSDeliver edge caches.
- The canary Accounts project will be deployed using the most recent `@canary` version of `@clerk/nextjs`.

## Stable releases

Expand All @@ -17,16 +17,16 @@ Actions that will be triggered:

For more details, refer to [PUBLISH.md](https://github.com/clerk/javascript/blob/main/docs/PUBLISH.md).

## Automated staging releases
## Automated canary releases

A staging release will be triggered every time PR is merged into `main`. Once versioning and publishing is done, the `clerk/javascript` repo will dispatch a workflow event, notifying other related Clerk repos of the new releases.
A canary release will be triggered every time PR is merged into `main`. Once versioning and publishing is done, the `clerk/javascript` repo will dispatch a workflow event, notifying other related Clerk repos of the new releases.

Actions that will be triggered:

- `clerk/cloudflare-workers`: The latest clerk-js versions in `clerkjs-proxy/wrangler.toml` will be updated and directly committed to `main`. A second workflow will perform a staging release of the `clerkjs-proxy` worker.
- `clerk/accounts`: A new Accounts deployment will take place, using the most recent staging `@clerk/nextjs` version. This change will not be committed to `main`.
- `clerk/cloudflare-workers`: The latest clerk-js versions in `clerkjs-proxy/wrangler.toml` will be updated and directly committed to `main`. A second workflow will perform a canary release of the `clerkjs-proxy` worker.
- `clerk/accounts`: A new Accounts deployment will take place, using the most recent canary `@clerk/nextjs` version. This change will not be committed to `main`.

For more details about staging releases, refer to [PUBLISH.md](https://github.com/clerk/javascript/blob/main/docs/PUBLISH.md).
For more details about canary releases, refer to [PUBLISH.md](https://github.com/clerk/javascript/blob/main/docs/PUBLISH.md).

## Quality checks

Expand Down
10 changes: 5 additions & 5 deletions docs/PUBLISH.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,13 @@ Every time a PR is merged into `main`, the changesets action parses all changese

To release a new stable version of all Clerk packages, find the "Version Packages" PR, verify the changes, and merge it.

## Publishing staging package versions (`@staging`)
## Publishing canary package versions (`@canary`)

An automated staging release will be take place every time a PR gets merged into `main`.
An automated canary release will be take place every time a PR gets merged into `main`.

- Staging versions use the following format: `@clerk/[email protected]staging.commit`, where `package` is the package name, `x`,`y`,`z` are the major, minor and patch versions respectively, `staging` is a stable prerelease mame and `commit` is the id of the last commit in the branch.
- Currently, staging version changes are _not_ committed to the repo and no git tags will be generated. Using this strategy, we avoid merge conflicts, allowing us to constantly deploy staging versions without switching the repo to a "prerelease" mode.
- During a staging release, `@clerk/clerk-js` will also be released. If needed, use the `clerkJSVersion` prop to use a specific version, eg: `<ClerkProvider clerkJSVersion='4.1.1-staging.90012' />`
- Canary versions use the following format: `@clerk/[email protected]canary.commit`, where `package` is the package name, `x`,`y`,`z` are the major, minor and patch versions respectively, `canary` is a stable prerelease mame and `commit` is the id of the last commit in the branch.
- Currently, canary version changes are _not_ committed to the repo and no git tags will be generated. Using this strategy, we avoid merge conflicts, allowing us to constantly deploy canary versions without switching the repo to a "prerelease" mode.
- During a canary release, `@clerk/clerk-js` will also be released. If needed, use the `clerkJSVersion` prop to use a specific version, eg: `<ClerkProvider clerkJSVersion='4.1.1-canary.90012' />`
- A package will not be published if it's not affected by a changeset.

## Publishing snapshot package versions (`@snapshot`)
Expand Down
Loading

0 comments on commit 4c34290

Please sign in to comment.