-
Notifications
You must be signed in to change notification settings - Fork 437
chore(repo): Various release workflow fixes #8020
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
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -84,28 +84,29 @@ jobs: | |
| 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 } | ||
| }) | ||
|
|
||
| github.rest.actions.createWorkflowDispatch({ | ||
| owner: 'clerk', | ||
| repo: 'dashboard', | ||
| workflow_id: 'prepare-nextjs-sdk-update.yml', | ||
| ref: 'main', | ||
| inputs: { version: nextjsVersion } | ||
| }) | ||
|
|
||
| github.rest.actions.createWorkflowDispatch({ | ||
| owner: 'clerk', | ||
| repo: 'clerk-docs', | ||
| workflow_id: 'typedoc.yml', | ||
| ref: 'main', | ||
| }) | ||
| const dispatches = [ | ||
| github.rest.actions.createWorkflowDispatch({ | ||
| owner: 'clerk', | ||
| repo: 'sdk-infra-workers', | ||
| workflow_id: 'update-pkg-versions.yml', | ||
| ref: 'main', | ||
| inputs: { clerkjsVersion, clerkUiVersion } | ||
| }), | ||
| github.rest.actions.createWorkflowDispatch({ | ||
| owner: 'clerk', | ||
| repo: 'dashboard', | ||
| workflow_id: 'prepare-nextjs-sdk-update.yml', | ||
| ref: 'main', | ||
| inputs: { version: nextjsVersion } | ||
| }), | ||
| github.rest.actions.createWorkflowDispatch({ | ||
| owner: 'clerk', | ||
| repo: 'clerk-docs', | ||
| workflow_id: 'typedoc.yml', | ||
| ref: 'main', | ||
| }), | ||
| ]; | ||
| await Promise.all(dispatches); | ||
| } else{ | ||
| core.warning("Changeset in pre-mode should not prepare a ClerkJS production release") | ||
| } | ||
|
|
@@ -185,25 +186,31 @@ jobs: | |
| 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, sourceCommit: context.sha } | ||
| }) | ||
|
|
||
| if (nextjsVersion.includes('canary')) { | ||
| console.log('clerk/nextjs changed, will notify clerk/accounts'); | ||
| const dispatches = [ | ||
| github.rest.actions.createWorkflowDispatch({ | ||
| owner: 'clerk', | ||
| repo: 'accounts', | ||
| workflow_id: 'release-staging.yml', | ||
| repo: 'sdk-infra-workers', | ||
| workflow_id: 'update-pkg-versions.yml', | ||
| ref: 'main', | ||
| inputs: { version: nextjsVersion } | ||
| }) | ||
| inputs: { clerkjsVersion, clerkUiVersion, sourceCommit: context.sha } | ||
| }), | ||
| ]; | ||
|
|
||
| if (nextjsVersion.includes('canary')) { | ||
| console.log('clerk/nextjs changed, will notify clerk/accounts'); | ||
| dispatches.push( | ||
| github.rest.actions.createWorkflowDispatch({ | ||
| owner: 'clerk', | ||
| repo: 'accounts', | ||
| workflow_id: 'release-staging.yml', | ||
| ref: 'main', | ||
| inputs: { version: nextjsVersion } | ||
| }), | ||
| ); | ||
| } | ||
|
|
||
| await Promise.all(dispatches); | ||
|
|
||
| snapshot-release: | ||
| name: Snapshot release | ||
| if: ${{ github.event_name == 'issue_comment' && startsWith(github.event.comment.body, '!snapshot') && github.repository == 'clerk/javascript' && github.event.issue.pull_request }} | ||
|
|
@@ -213,6 +220,7 @@ jobs: | |
| permissions: | ||
| contents: read | ||
| id-token: write | ||
| pull-requests: write | ||
|
|
||
| steps: | ||
| - name: Limit action to Clerk members | ||
|
|
@@ -249,16 +257,14 @@ jobs: | |
| result-encoding: string | ||
| retries: 3 | ||
| retry-exempt-status-codes: 400,401 | ||
| github-token: ${{ secrets.CLERK_COOKIE_PAT }} | ||
|
Contributor
Author
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.
|
||
| script: | | ||
| const commentCreated = new Date(context.payload.comment.created_at); | ||
|
|
||
| const pr = await github.rest.pulls.get({ | ||
| const { data: pr } = await github.rest.pulls.get({ | ||
| owner: 'clerk', | ||
| repo: 'javascript', | ||
| pull_number: context.issue.number, | ||
| }); | ||
|
|
||
| const prLastUpdated = new Date(pr.updated_at); | ||
|
|
||
| if (prLastUpdated > commentCreated) { | ||
|
|
@@ -291,15 +297,15 @@ jobs: | |
|
|
||
| - name: Version packages for snapshot | ||
| id: version-packages | ||
| run: npm run version-packages:snapshot ${{ steps.extract-snapshot-name.outputs.name }} | tail -1 >> "$GITHUB_OUTPUT" | ||
| run: pnpm version-packages:snapshot ${{ steps.extract-snapshot-name.outputs.name }} | tail -1 >> "$GITHUB_OUTPUT" | ||
|
|
||
| - name: Build release | ||
| if: steps.version-packages.outputs.success == '1' | ||
| run: npx turbo build $TURBO_ARGS | ||
| run: pnpm turbo build $TURBO_ARGS | ||
|
|
||
| - name: Snapshot release | ||
| if: steps.version-packages.outputs.success == '1' | ||
| run: npm run release:snapshot | ||
| run: pnpm release:snapshot | ||
| env: | ||
| NPM_CONFIG_PROVENANCE: true | ||
|
|
||
|
|
@@ -335,15 +341,13 @@ jobs: | |
| if: steps.version-packages.outputs.success == '1' | ||
| uses: peter-evans/create-or-update-comment@v3.0.0 | ||
| with: | ||
| token: ${{ secrets.CLERK_COOKIE_PAT }} | ||
|
Contributor
Author
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. GITHUB_TOKEN is the default value, no need to be explicit, see https://github.com/peter-evans/create-or-update-comment/tree/v3.0.0 |
||
| comment-id: ${{ github.event.comment.id }} | ||
| reactions: heart | ||
|
|
||
| - name: Minimize previous snapshot comments | ||
| if: steps.version-packages.outputs.success == '1' | ||
| uses: actions/github-script@v7 | ||
| with: | ||
| github-token: ${{ secrets.CLERK_COOKIE_PAT }} | ||
| script: | | ||
| const { data: comments } = await github.rest.issues.listComments({ | ||
| owner: context.repo.owner, | ||
|
|
@@ -373,7 +377,6 @@ jobs: | |
| if: steps.version-packages.outputs.success == '1' | ||
| uses: peter-evans/create-or-update-comment@v3.0.0 | ||
| with: | ||
| token: ${{ secrets.CLERK_COOKIE_PAT }} | ||
| issue-number: ${{ github.event.issue.number }} | ||
| body: | | ||
| Hey @${{ github.event.comment.user.login }} - the snapshot version command generated the following package versions: | ||
|
|
||
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.
Needed so that
GITHUB_TOKENcan react to!snapshotcomments and write the response when the release finishes.