Skip to content
Merged
Changes from 3 commits
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
69 changes: 30 additions & 39 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,6 +74,7 @@ jobs:

- name: Trigger workflows on related repos
if: steps.changesets.outputs.published == 'true'
continue-on-error: true
Comment thread
coderabbitai[bot] marked this conversation as resolved.
uses: actions/github-script@v7
with:
result-encoding: string
Expand All @@ -87,29 +88,21 @@ jobs:
const clerkUiVersion = require('./packages/ui/package.json').version;
const nextjsVersion = require('./packages/nextjs/package.json').version;

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',
}),
const targets = [
{ repo: 'sdk-infra-workers', workflow_id: 'update-pkg-versions.yml', inputs: { clerkjsVersion, clerkUiVersion } },
{ repo: 'dashboard', workflow_id: 'prepare-nextjs-sdk-update.yml', inputs: { version: nextjsVersion } },
{ repo: 'clerk-docs', workflow_id: 'typedoc.yml' },
];
await Promise.all(dispatches);
const results = await Promise.allSettled(
targets.map(t => github.rest.actions.createWorkflowDispatch({ owner: 'clerk', ref: 'main', ...t }))
);
const failures = results
.map((r, i) => r.status === 'rejected' ? { target: targets[i], reason: r.reason } : null)
.filter(Boolean);
if (failures.length) {
failures.forEach(f => core.error(`Dispatch to ${f.target.repo}/${f.target.workflow_id} failed: ${f.reason?.message ?? f.reason}`));
core.setFailed(`${failures.length} downstream dispatch(es) failed`);
}
} else{
core.warning("Changeset in pre-mode should not prepare a ClerkJS production release")
}
Expand Down Expand Up @@ -198,6 +191,7 @@ jobs:

- name: Trigger workflows on related repos
if: steps.publish.outcome == 'success'
continue-on-error: true
uses: actions/github-script@v7
with:
result-encoding: string
Expand All @@ -209,30 +203,27 @@ jobs:
const clerkUiVersion = require('./packages/ui/package.json').version;
const nextjsVersion = require('./packages/nextjs/package.json').version;

const dispatches = [
github.rest.actions.createWorkflowDispatch({
owner: 'clerk',
repo: 'sdk-infra-workers',
workflow_id: 'update-pkg-versions.yml',
ref: 'main',
inputs: { clerkjsVersion, clerkUiVersion, sourceCommit: context.sha }
}),
const targets = [
{ repo: 'sdk-infra-workers', workflow_id: 'update-pkg-versions.yml', 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 }
}),
targets.push(
{ repo: 'accounts', workflow_id: 'release-staging.yml', inputs: { version: nextjsVersion } },
);
}

await Promise.all(dispatches);
const results = await Promise.allSettled(
targets.map(t => github.rest.actions.createWorkflowDispatch({ owner: 'clerk', ref: 'main', ...t }))
);
const failures = results
.map((r, i) => r.status === 'rejected' ? { target: targets[i], reason: r.reason } : null)
.filter(Boolean);
if (failures.length) {
failures.forEach(f => core.error(`Dispatch to ${f.target.repo}/${f.target.workflow_id} failed: ${f.reason?.message ?? f.reason}`));
core.setFailed(`${failures.length} downstream dispatch(es) failed`);
}

- name: Notify Slack on failure
if: ${{ always() && steps.publish.outcome == 'failure' }}
Expand Down
Loading