|
4 | 4 | push: |
5 | 5 | branches: |
6 | 6 | - main |
| 7 | + workflow_dispatch: |
| 8 | + inputs: |
| 9 | + confirm_publish_cli: |
| 10 | + description: "Type 'publish-cli' to re-run only the publish-cli job against the current main (e.g. when a prior run failed after the other packages were already published). The version published is whatever is in packages/cli/package.json on main." |
| 11 | + required: true |
| 12 | + type: string |
7 | 13 |
|
8 | 14 | permissions: {} |
9 | 15 |
|
10 | 16 | jobs: |
11 | 17 | release-please: |
| 18 | + # Skip on manual dispatch: the manual path exists only to re-run publish-cli. |
| 19 | + if: github.event_name != 'workflow_dispatch' |
12 | 20 | runs-on: ubuntu-24.04 |
13 | 21 | permissions: |
14 | 22 | contents: write |
|
59 | 67 | publish-packages: |
60 | 68 | runs-on: ubuntu-24.04 |
61 | 69 | needs: release-please |
62 | | - if: needs.release-please.outputs.releases_created == 'true' |
| 70 | + # Never run on manual dispatch — the manual path is only for re-running publish-cli when the |
| 71 | + # other packages were already published in a prior run. Republishing them would fail with 403. |
| 72 | + if: github.event_name != 'workflow_dispatch' && needs.release-please.outputs.releases_created == 'true' |
63 | 73 | permissions: |
64 | 74 | id-token: write # Required for trusted publishing via OIDC (https://docs.npmjs.com/trusted-publishers) |
65 | 75 | # The GitHub Actions Environment configured for the trusted publisher |
@@ -90,7 +100,22 @@ jobs: |
90 | 100 | publish-cli: |
91 | 101 | runs-on: ubuntu-24.04 |
92 | 102 | needs: [release-please, publish-packages] |
93 | | - if: needs.release-please.outputs.releases_created == 'true' |
| 103 | + # Two paths: |
| 104 | + # 1. Automatic: release-please created releases and publish-packages succeeded |
| 105 | + # 2. Manual: workflow_dispatch with the confirmation input set to "publish-cli" |
| 106 | + # `always()` is required so this job is not auto-skipped when the upstream jobs are skipped |
| 107 | + # on the manual path. |
| 108 | + if: | |
| 109 | + always() && ( |
| 110 | + ( |
| 111 | + github.event_name == 'push' |
| 112 | + && needs.release-please.outputs.releases_created == 'true' |
| 113 | + && needs.publish-packages.result == 'success' |
| 114 | + ) || ( |
| 115 | + github.event_name == 'workflow_dispatch' |
| 116 | + && inputs.confirm_publish_cli == 'publish-cli' |
| 117 | + ) |
| 118 | + ) |
94 | 119 | permissions: |
95 | 120 | id-token: write # Required for trusted publishing via OIDC (https://docs.npmjs.com/trusted-publishers) |
96 | 121 | # The GitHub Actions Environment configured for the trusted publisher |
|
0 commit comments