diff --git a/.github/workflows/electron-release.yml b/.github/workflows/electron-release.yml index e899a664ea..913071d311 100644 --- a/.github/workflows/electron-release.yml +++ b/.github/workflows/electron-release.yml @@ -10,6 +10,11 @@ on: description: "Release version (e.g., v1.6.8)" required: true type: string + publish_npm: + description: "Also run the npm publish leg (turn off when re-attaching desktop assets to a release whose npm package already shipped)" + required: false + default: true + type: boolean # Least-privilege default: read-only at the top level; each job grants the writes it # needs (build/release upload assets, publish-npm forwards npm provenance / packages @@ -76,6 +81,9 @@ jobs: - uses: actions/checkout@v7 with: persist-credentials: false + # workflow_dispatch: build the tag being (re)built, not the dispatching branch. On a + # tag push this resolves to the same commit. + ref: ${{ needs.validate.outputs.version }} - name: Setup Node uses: actions/setup-node@v7 with: @@ -161,6 +169,9 @@ jobs: - uses: actions/checkout@v7 with: persist-credentials: false + # workflow_dispatch: build the tag being (re)built, not the dispatching branch. On a + # tag push this resolves to the same commit. + ref: ${{ needs.validate.outputs.version }} - name: Setup Node uses: actions/setup-node@v7 with: @@ -347,6 +358,8 @@ jobs: with: persist-credentials: false fetch-depth: 0 + # Source archives + SBOM come from the tag being released, not the dispatching branch. + ref: ${{ needs.validate.outputs.version }} # `merge-multiple` is deliberately OFF. It resolves same-name collisions by ARRIVAL # ORDER, and the two macOS jobs each emit their own `latest-mac.yml` listing only their @@ -462,11 +475,20 @@ jobs: publish-npm: name: Publish to npm needs: [validate, release] + # A re-dispatch that only re-attaches desktop assets must not publish the npm package again. + if: ${{ github.event_name != 'workflow_dispatch' || inputs.publish_npm }} permissions: # Must be `write`, not `read`: this job calls the reusable npm-publish.yml whose # `publish` job needs `contents: write` (gh release upload — attach the SBOM, #3874). # A reusable workflow's job cannot request more permission than the caller grants, # so a `read` here makes GitHub reject the run at startup (startup_failure). + # + # `actions: read` for the same reason: the called `publish` job downloads the next-build + # artefact and requests it. v3.8.50 (run 33005490476) died at startup with "The nested + # job 'publish' is requesting 'actions: read', but is only allowed 'actions: none'" — and + # because `release` lives in this same workflow, the tag shipped with ZERO assets. Keep + # this block a superset of every job's permissions in npm-publish.yml. + actions: read contents: write id-token: write # npm provenance (forwarded to the reusable workflow) packages: write # publish to npm.pkg.github.com diff --git a/changelog.d/fixes/v3850-electron-release-assets.md b/changelog.d/fixes/v3850-electron-release-assets.md new file mode 100644 index 0000000000..255efd829c --- /dev/null +++ b/changelog.d/fixes/v3850-electron-release-assets.md @@ -0,0 +1 @@ +- Electron release workflow: the `publish-npm` job now grants `actions: read` to the reusable `npm-publish.yml` it calls (its `publish` job requests it), which is what made GitHub refuse the whole v3.8.50 run at startup and ship the release with zero desktop assets; a `workflow_dispatch` now builds the requested tag instead of the dispatching branch and can skip the npm leg (`publish_npm=false`) when only re-attaching assets