Skip to content

Commit d004b53

Browse files
jaymaycryclaude
andcommitted
ci: add workflow_dispatch + --force npm upgrade so a failed publish can be retried
Two changes wrapped together because they unblock the same problem. `npm install -g npm@latest` fails inside the publish job with `Cannot find module 'promise-retry'` — a known npm self-upgrade bug where the in-place install removes the running npm's own dependencies mid-flight. Adding `--force` bypasses that broken state and lets the install complete. Re-running the failed workflow uses the workflow file from the original triggering SHA, so a fix on `main` can't unblock the existing v0.1.1 publish that already failed. Adding a `workflow_dispatch` trigger with a `publish_tag` input lets the publish job be triggered manually against any tag: release-please is skipped, checkout uses the input ref, and the publish job's `if:` condition is widened to allow workflow_dispatch runs. Filename stays `release-please.yml` so npm Trusted Publishing still matches. Co-Authored-By: Claude Opus 4.7 (1M context) <noreply@anthropic.com>
1 parent 30ece9b commit d004b53

1 file changed

Lines changed: 11 additions & 2 deletions

File tree

.github/workflows/release-please.yml

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,12 @@ name: Release Please
33
on:
44
push:
55
branches: [main]
6+
workflow_dispatch:
7+
inputs:
8+
publish_tag:
9+
description: 'Tag to publish (e.g. v0.1.1). Leave blank to let release-please run normally.'
10+
required: false
11+
default: ''
612

713
permissions:
814
contents: write
@@ -12,6 +18,7 @@ jobs:
1218
release-please:
1319
name: Release PR / tag
1420
runs-on: ubuntu-latest
21+
if: ${{ github.event_name != 'workflow_dispatch' || inputs.publish_tag == '' }}
1522
outputs:
1623
release_created: ${{ steps.release.outputs.release_created }}
1724
tag_name: ${{ steps.release.outputs.tag_name }}
@@ -25,14 +32,16 @@ jobs:
2532
publish:
2633
name: Publish to npm
2734
needs: release-please
28-
if: ${{ needs.release-please.outputs.release_created == 'true' }}
35+
if: ${{ always() && ((github.event_name == 'workflow_dispatch' && inputs.publish_tag != '') || needs.release-please.outputs.release_created == 'true') }}
2936
runs-on: ubuntu-latest
3037
permissions:
3138
contents: read
3239
id-token: write
3340
steps:
3441
- name: Checkout
3542
uses: actions/checkout@v4
43+
with:
44+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.publish_tag || github.ref }}
3645

3746
- name: Setup Node.js
3847
uses: actions/setup-node@v4
@@ -48,7 +57,7 @@ jobs:
4857
run: yarn prepare
4958

5059
- name: Upgrade npm (Trusted Publishing requires >= 11.5.1)
51-
run: npm install -g npm@latest
60+
run: npm install -g --force npm@latest
5261

5362
- name: Publish
5463
run: npm publish --access public

0 commit comments

Comments
 (0)