Skip to content

Commit bdad845

Browse files
authored
ci: Add manual release dispatch (#1840)
I know this removes a bit of a guardrail but if something gets messed up, this is crucial. Basically just replaces the second part of the release workflow (merging the release PR).
1 parent 6428774 commit bdad845

File tree

1 file changed

+75
-1
lines changed

1 file changed

+75
-1
lines changed

.github/workflows/publish-js-sdk.yaml

Lines changed: 75 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@ on:
1111
required: true
1212
type: choice
1313
options:
14+
- stable
1415
- prerelease
1516
- canary
1617
- dry-run-stable
@@ -21,7 +22,7 @@ on:
2122
required: false
2223
type: string
2324
ref:
24-
description: Ref to use for stable/canary dry runs
25+
description: Ref to use for stable and dry-run stable/canary modes
2526
required: false
2627
default: main
2728
type: string
@@ -165,6 +166,77 @@ jobs:
165166
id: summary
166167
run: node scripts/release/summarize-release.mjs --mode stable --manifest .release-manifest.json
167168
- name: Post stable release to Slack
169+
if: steps.detect.outputs.has_work == 'true'
170+
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
171+
with:
172+
method: chat.postMessage
173+
token: ${{ secrets.SLACK_BOT_TOKEN }}
174+
payload: |
175+
channel: C0ABHT0SWA2
176+
text: "✅ JavaScript packages published"
177+
blocks:
178+
- type: "header"
179+
text:
180+
type: "plain_text"
181+
text: "✅ JavaScript packages published"
182+
- type: "section"
183+
text:
184+
type: "mrkdwn"
185+
text: "*Packages:*\n${{ steps.summary.outputs.markdown }}\n\n<${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}|View Run>"
186+
187+
stable-manual-release:
188+
if: github.event_name == 'workflow_dispatch' && inputs.release_mode == 'stable'
189+
runs-on: ubuntu-latest
190+
timeout-minutes: 30
191+
permissions:
192+
contents: write
193+
id-token: write
194+
environment: npm-publish
195+
steps:
196+
- uses: actions/checkout@34e114876b0b11c390a56381ad16ebd13914f8d5 # v4.3.1
197+
with:
198+
fetch-depth: 0
199+
ref: ${{ inputs.ref || 'main' }}
200+
- uses: pnpm/action-setup@fc06bc1257f339d1d5d8b3a19a8cae5388b55320 # v5.0.0
201+
- uses: actions/setup-node@49933ea5288caeca8642d1e84afbd3f7d6820020 # v4.4.0
202+
with:
203+
node-version-file: .tool-versions
204+
cache: pnpm
205+
registry-url: https://registry.npmjs.org
206+
- name: Install dependencies
207+
run: pnpm install --frozen-lockfile
208+
- name: Validate publishable package metadata
209+
run: node scripts/release/validate-publishable-packages.mjs
210+
- name: Detect stable publish work
211+
id: detect
212+
env:
213+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
214+
run: node scripts/release/should-publish-stable.mjs --output .release-manifest.json
215+
- name: Configure git user
216+
run: |
217+
git config user.name "github-actions[bot]"
218+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
219+
- name: Build publishable packages
220+
if: steps.detect.outputs.needs_publish == 'true'
221+
run: bash scripts/release/build-publishable-packages.sh .release-manifest.json
222+
- name: Publish stable packages to npm
223+
if: steps.detect.outputs.needs_publish == 'true'
224+
run: pnpm exec changeset publish
225+
env:
226+
NPM_TOKEN: ""
227+
- name: Push Changesets release tags
228+
if: steps.detect.outputs.has_work == 'true'
229+
run: node scripts/release/push-release-tags.mjs --manifest .release-manifest.json
230+
- name: Create GitHub Releases
231+
if: steps.detect.outputs.has_work == 'true'
232+
env:
233+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
234+
run: node scripts/release/create-github-releases.mjs --manifest .release-manifest.json
235+
- name: Summarize stable release
236+
id: summary
237+
run: node scripts/release/summarize-release.mjs --mode stable --manifest .release-manifest.json
238+
- name: Post stable release to Slack
239+
if: steps.detect.outputs.has_work == 'true'
168240
uses: slackapi/slack-github-action@af78098f536edbc4de71162a307590698245be95 # v3.0.1
169241
with:
170242
method: chat.postMessage
@@ -274,6 +346,7 @@ jobs:
274346
stable-release-pr,
275347
stable-detect-publish,
276348
stable-publish,
349+
stable-manual-release,
277350
prerelease-snapshot,
278351
canary-snapshot,
279352
dry-run-stable,
@@ -286,6 +359,7 @@ jobs:
286359
needs.stable-release-pr.result == 'failure' ||
287360
needs.stable-detect-publish.result == 'failure' ||
288361
needs.stable-publish.result == 'failure' ||
362+
needs.stable-manual-release.result == 'failure' ||
289363
needs.prerelease-snapshot.result == 'failure' ||
290364
needs.canary-snapshot.result == 'failure' ||
291365
needs.dry-run-stable.result == 'failure' ||

0 commit comments

Comments
 (0)