Skip to content

Commit 34e4981

Browse files
chore(repo): Various release workflow fixes (#8020)
1 parent 766ae5b commit 34e4981

1 file changed

Lines changed: 48 additions & 45 deletions

File tree

.github/workflows/release.yml

Lines changed: 48 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -84,28 +84,29 @@ jobs:
8484
const clerkUiVersion = require('./packages/ui/package.json').version;
8585
const nextjsVersion = require('./packages/nextjs/package.json').version;
8686
87-
github.rest.actions.createWorkflowDispatch({
88-
owner: 'clerk',
89-
repo: 'sdk-infra-workers',
90-
workflow_id: 'update-pkg-versions.yml',
91-
ref: 'main',
92-
inputs: { clerkjsVersion, clerkUiVersion }
93-
})
94-
95-
github.rest.actions.createWorkflowDispatch({
96-
owner: 'clerk',
97-
repo: 'dashboard',
98-
workflow_id: 'prepare-nextjs-sdk-update.yml',
99-
ref: 'main',
100-
inputs: { version: nextjsVersion }
101-
})
102-
103-
github.rest.actions.createWorkflowDispatch({
104-
owner: 'clerk',
105-
repo: 'clerk-docs',
106-
workflow_id: 'typedoc.yml',
107-
ref: 'main',
108-
})
87+
const dispatches = [
88+
github.rest.actions.createWorkflowDispatch({
89+
owner: 'clerk',
90+
repo: 'sdk-infra-workers',
91+
workflow_id: 'update-pkg-versions.yml',
92+
ref: 'main',
93+
inputs: { clerkjsVersion, clerkUiVersion }
94+
}),
95+
github.rest.actions.createWorkflowDispatch({
96+
owner: 'clerk',
97+
repo: 'dashboard',
98+
workflow_id: 'prepare-nextjs-sdk-update.yml',
99+
ref: 'main',
100+
inputs: { version: nextjsVersion }
101+
}),
102+
github.rest.actions.createWorkflowDispatch({
103+
owner: 'clerk',
104+
repo: 'clerk-docs',
105+
workflow_id: 'typedoc.yml',
106+
ref: 'main',
107+
}),
108+
];
109+
await Promise.all(dispatches);
109110
} else{
110111
core.warning("Changeset in pre-mode should not prepare a ClerkJS production release")
111112
}
@@ -185,25 +186,31 @@ jobs:
185186
const clerkUiVersion = require('./packages/ui/package.json').version;
186187
const nextjsVersion = require('./packages/nextjs/package.json').version;
187188
188-
github.rest.actions.createWorkflowDispatch({
189-
owner: 'clerk',
190-
repo: 'sdk-infra-workers',
191-
workflow_id: 'update-pkg-versions.yml',
192-
ref: 'main',
193-
inputs: { clerkjsVersion, clerkUiVersion, sourceCommit: context.sha }
194-
})
195-
196-
if (nextjsVersion.includes('canary')) {
197-
console.log('clerk/nextjs changed, will notify clerk/accounts');
189+
const dispatches = [
198190
github.rest.actions.createWorkflowDispatch({
199191
owner: 'clerk',
200-
repo: 'accounts',
201-
workflow_id: 'release-staging.yml',
192+
repo: 'sdk-infra-workers',
193+
workflow_id: 'update-pkg-versions.yml',
202194
ref: 'main',
203-
inputs: { version: nextjsVersion }
204-
})
195+
inputs: { clerkjsVersion, clerkUiVersion, sourceCommit: context.sha }
196+
}),
197+
];
198+
199+
if (nextjsVersion.includes('canary')) {
200+
console.log('clerk/nextjs changed, will notify clerk/accounts');
201+
dispatches.push(
202+
github.rest.actions.createWorkflowDispatch({
203+
owner: 'clerk',
204+
repo: 'accounts',
205+
workflow_id: 'release-staging.yml',
206+
ref: 'main',
207+
inputs: { version: nextjsVersion }
208+
}),
209+
);
205210
}
206211
212+
await Promise.all(dispatches);
213+
207214
snapshot-release:
208215
name: Snapshot release
209216
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:
213220
permissions:
214221
contents: read
215222
id-token: write
223+
pull-requests: write
216224

217225
steps:
218226
- name: Limit action to Clerk members
@@ -249,16 +257,14 @@ jobs:
249257
result-encoding: string
250258
retries: 3
251259
retry-exempt-status-codes: 400,401
252-
github-token: ${{ secrets.CLERK_COOKIE_PAT }}
253260
script: |
254261
const commentCreated = new Date(context.payload.comment.created_at);
255262
256-
const pr = await github.rest.pulls.get({
263+
const { data: pr } = await github.rest.pulls.get({
257264
owner: 'clerk',
258265
repo: 'javascript',
259266
pull_number: context.issue.number,
260267
});
261-
262268
const prLastUpdated = new Date(pr.updated_at);
263269
264270
if (prLastUpdated > commentCreated) {
@@ -291,15 +297,15 @@ jobs:
291297
292298
- name: Version packages for snapshot
293299
id: version-packages
294-
run: npm run version-packages:snapshot ${{ steps.extract-snapshot-name.outputs.name }} | tail -1 >> "$GITHUB_OUTPUT"
300+
run: pnpm version-packages:snapshot ${{ steps.extract-snapshot-name.outputs.name }} | tail -1 >> "$GITHUB_OUTPUT"
295301

296302
- name: Build release
297303
if: steps.version-packages.outputs.success == '1'
298-
run: npx turbo build $TURBO_ARGS
304+
run: pnpm turbo build $TURBO_ARGS
299305

300306
- name: Snapshot release
301307
if: steps.version-packages.outputs.success == '1'
302-
run: npm run release:snapshot
308+
run: pnpm release:snapshot
303309
env:
304310
NPM_CONFIG_PROVENANCE: true
305311

@@ -335,15 +341,13 @@ jobs:
335341
if: steps.version-packages.outputs.success == '1'
336342
uses: peter-evans/create-or-update-comment@v3.0.0
337343
with:
338-
token: ${{ secrets.CLERK_COOKIE_PAT }}
339344
comment-id: ${{ github.event.comment.id }}
340345
reactions: heart
341346

342347
- name: Minimize previous snapshot comments
343348
if: steps.version-packages.outputs.success == '1'
344349
uses: actions/github-script@v7
345350
with:
346-
github-token: ${{ secrets.CLERK_COOKIE_PAT }}
347351
script: |
348352
const { data: comments } = await github.rest.issues.listComments({
349353
owner: context.repo.owner,
@@ -373,7 +377,6 @@ jobs:
373377
if: steps.version-packages.outputs.success == '1'
374378
uses: peter-evans/create-or-update-comment@v3.0.0
375379
with:
376-
token: ${{ secrets.CLERK_COOKIE_PAT }}
377380
issue-number: ${{ github.event.issue.number }}
378381
body: |
379382
Hey @${{ github.event.comment.user.login }} - the snapshot version command generated the following package versions:

0 commit comments

Comments
 (0)