Uh oh!
There was an error while loading. Please reload this page.
- Notifications
You must be signed in to change notification settings - Fork 4
feat: add release infrastructure with changesets [3/4]#45
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Uh oh!
There was an error while loading. Please reload this page.
Changes from all commits
d849ce63d5e9ab2f4032d196876b58f0934File filter
Filter by extension
Conversations
Uh oh!
There was an error while loading. Please reload this page.
Jump to
Uh oh!
There was an error while loading. Please reload this page.
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,11 @@ | ||
| # Changesets | ||
| This directory is used by [Changesets](https://github.com/changesets/changesets) to manage versioning and changelogs. | ||
| To add a changeset, run: | ||
| ```sh | ||
| bunx changeset | ||
| ``` | ||
| This will prompt you to select the packages that changed and the type of change (patch, minor, major). A markdown file will be created in this directory describing the change — commit it with your PR. |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| { | ||
| "$schema": "https://unpkg.com/@changesets/config@2.3.0/schema.json", | ||
| "changelog": "@changesets/cli/changelog", | ||
| "commit": false, | ||
| "linked": [], | ||
| "access": "public", | ||
| "baseBranch": "origin/main", | ||
| "updateInternalDependencies": "patch", | ||
| "ignore": ["@clerk/cli-core"], | ||
| "snapshot": { | ||
| "useCalculatedVersion": true, | ||
| "prereleaseTemplate": "{tag}.v{datetime}" | ||
| } | ||
| } |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,3 @@ | ||
| self-hosted-runner: | ||
| labels: | ||
| - blacksmith-2vcpu-ubuntu-2404 |
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,188 @@ | ||
| name: Release | ||
| on: | ||
| push: | ||
| branches: [main] | ||
| concurrency: | ||
| group: release | ||
| cancel-in-progress: false | ||
| permissions: | ||
| contents: read | ||
| jobs: | ||
| versioning: | ||
| runs-on: blacksmith-2vcpu-ubuntu-2404 | ||
| timeout-minutes: 5 | ||
| permissions: | ||
| contents: write | ||
| pull-requests: write | ||
| outputs: | ||
| release_created: ${{ steps.check.outputs.release_created }} | ||
| version: ${{ steps.check.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - run: bun install --frozen-lockfile | ||
| - name: Check if release needed | ||
| id: check | ||
| run: bun run scripts/check-release.ts | ||
| - id: changesets | ||
| uses: changesets/action@v1 | ||
| with: | ||
| version: bun run version-packages | ||
| commit: "ci(repo): version packages" | ||
| title: "ci(repo): Version Packages" | ||
| env: | ||
| GITHUB_TOKEN: ${{ github.token }} | ||
| # ─── Stable release ──────────────────────────────────────────────── | ||
| build: | ||
| needs: versioning | ||
| if: ${{ needs.versioning.outputs.release_created == 'true' }} | ||
| uses: ./.github/workflows/build-binaries.yml | ||
| with: | ||
| version: ${{ needs.versioning.outputs.version }} | ||
| ref: ${{ github.sha }} | ||
| artifact-prefix: clerk | ||
| smoke-test: | ||
| needs: [versioning, build] | ||
| uses: ./.github/workflows/smoke-test.yml | ||
| with: | ||
| version: ${{ needs.versioning.outputs.version }} | ||
| artifact-prefix: clerk | ||
| preset: stable | ||
| publish-npm: | ||
| needs: [versioning, build, smoke-test] | ||
| # Must run on GitHub-hosted runner for npm OIDC trusted publishing | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| permissions: | ||
| contents: write | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "22" | ||
| registry-url: "https://registry.npmjs.org" | ||
| - name: Upgrade npm for OIDC trusted publishing | ||
| run: npm install -g npm@11 | ||
| - run: bun install --frozen-lockfile | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: clerk-* | ||
| path: dist/artifacts | ||
| - name: Publish packages | ||
| run: bun run release | ||
| env: | ||
| ARTIFACTS_DIR: ${{ github.workspace }}/dist/artifacts | ||
| GH_TOKEN: ${{ github.token }} | ||
| upload-github-assets: | ||
| needs: [versioning, build, smoke-test, publish-npm] | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 10 | ||
| permissions: | ||
| contents: write | ||
| steps: | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: clerk-* | ||
| path: dist/artifacts | ||
| - name: Upload binaries to GitHub Release | ||
| env: | ||
| GH_TOKEN: ${{ github.token }} | ||
| GH_REPO: ${{ github.repository }} | ||
| run: | | ||
| tag="v${{ needs.versioning.outputs.version }}" | ||
| for dir in dist/artifacts/clerk-*/; do | ||
| target=${dir#dist/artifacts/clerk-} && target=${target%/} | ||
| ext=""; [[ "$target" == win32-* ]] && ext=".exe" | ||
| gh release upload "$tag" "${dir}clerk${ext}#clerk-${target}${ext}" --clobber | ||
| done | ||
| # ─── Canary release ──────────────────────────────────────────────── | ||
| canary-version: | ||
| needs: versioning | ||
| if: ${{ needs.versioning.outputs.release_created != 'true' }} | ||
| runs-on: blacksmith-2vcpu-ubuntu-2404 | ||
| timeout-minutes: 5 | ||
| outputs: | ||
| version: ${{ steps.version.outputs.version }} | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - run: bun install --frozen-lockfile | ||
| - name: Version packages for canary | ||
| id: version | ||
| run: | | ||
| bun run version-packages:canary | ||
| version=$(jq -r '.version' packages/cli/package.json) | ||
| echo "version=${version}" >> "$GITHUB_OUTPUT" | ||
| canary-build: | ||
| needs: canary-version | ||
| uses: ./.github/workflows/build-binaries.yml | ||
| with: | ||
| version: ${{ needs.canary-version.outputs.version }} | ||
| ref: ${{ github.sha }} | ||
| artifact-prefix: clerk-canary | ||
| canary-smoke-test: | ||
| needs: [canary-version, canary-build] | ||
| uses: ./.github/workflows/smoke-test.yml | ||
| with: | ||
| version: ${{ needs.canary-version.outputs.version }} | ||
| artifact-prefix: clerk-canary | ||
| preset: canary | ||
| canary-publish: | ||
| needs: [canary-version, canary-build, canary-smoke-test] | ||
| # Must run on GitHub-hosted runner for npm OIDC trusted publishing | ||
| runs-on: ubuntu-latest | ||
| timeout-minutes: 15 | ||
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| steps: | ||
| - uses: actions/checkout@v4 | ||
| - uses: oven-sh/setup-bun@v2 | ||
| - uses: actions/setup-node@v4 | ||
| with: | ||
| node-version: "22" | ||
| registry-url: "https://registry.npmjs.org" | ||
| - name: Upgrade npm for OIDC trusted publishing | ||
| run: npm install -g npm@11 | ||
| - run: bun install --frozen-lockfile | ||
| - uses: actions/download-artifact@v4 | ||
| with: | ||
| pattern: clerk-canary-* | ||
| path: dist/artifacts | ||
| - name: Rename artifact directories | ||
| run: | | ||
| cd dist/artifacts | ||
| for dir in clerk-canary-*/; do | ||
| target=${dir#clerk-canary-} && target=${target%/} | ||
| mv "$dir" "clerk-${target}" | ||
| done | ||
| - name: Publish canary packages | ||
| run: bun run release:canary --version "$CANARY_VERSION" | ||
| env: | ||
| CANARY_VERSION: ${{ needs.canary-version.outputs.version }} | ||
| ARTIFACTS_DIR: ${{ github.workspace }}/dist/artifacts | ||
Comment on lines
+184
to
+188
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Missing trailing newline at end of file. The file ends at line 188 without a trailing newline. POSIX text files should end with a newline. 🤖 Prompt for AI Agents | ||
Uh oh!
There was an error while loading. Please reload this page.
Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
🧹 Nitpick | 🔵 Trivial
Consider adding error handling for missing release tag.
The script assumes the release tag
v${version}already exists. If the tag wasn't created by a previous step (e.g.,publish-npmfailed to create it), this step will fail. Consider adding a check or ensuring the releaser script creates the tag before this job runs.🛡️ Optional: Add existence check
run: | tag="v${{ needs.versioning.outputs.version }}" + if ! gh release view "$tag" &>/dev/null; then+ echo "::error::Release $tag does not exist"+ exit 1+ fi for dir in dist/artifacts/clerk-*/; do📝 Committable suggestion
🤖 Prompt for AI Agents