File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -15,6 +15,18 @@ permissions:
1515 contents : read
1616 id-token : write
1717
18+ # Belt-and-suspenders: release.yml dispatches us explicitly because
19+ # `workflow_run` is unreliable when the upstream `Release` run was itself
20+ # triggered by a GITHUB_TOKEN workflow_dispatch. If both paths happen to
21+ # fire for the same release, this static concurrency group serializes them
22+ # — the first one publishes, the second waits and then no-ops (or errors
23+ # benignly at `npm publish` because the version is already on the registry).
24+ # Releases are version-monotonic so blanket serialisation is safe; there
25+ # isn't a scenario where two concurrent publishes should both succeed.
26+ concurrency :
27+ group : npm-publish
28+ cancel-in-progress : false
29+
1830jobs :
1931 npm-publish :
2032 if : >-
Original file line number Diff line number Diff line change @@ -15,6 +15,10 @@ concurrency:
1515
1616permissions :
1717 contents : write
18+ # `actions: write` is needed for the final step that dispatches
19+ # npm-publish.yml via `gh workflow run`. Without it, `gh workflow run`
20+ # gets a 403 from the GitHub API.
21+ actions : write
1822
1923env :
2024 CARGO_TERM_COLOR : always
@@ -364,3 +368,24 @@ jobs:
364368 prerelease : false
365369 body_path : release-notes.md
366370 files : release/*
371+
372+ # Explicit hand-off to npm-publish.yml.
373+ #
374+ # We can't rely solely on the `workflow_run` trigger in npm-publish.yml
375+ # because this Release workflow is itself triggered by a workflow
376+ # dispatch from auto-release.yml's GITHUB_TOKEN, and GitHub's
377+ # automatic-token rules don't list `workflow_run` as an exception to
378+ # the "events from GITHUB_TOKEN don't create new workflow runs" rule.
379+ # In practice that means the workflow_run chain silently no-ops on
380+ # auto-cut releases. Dispatching directly here makes the publish step
381+ # deterministic — the workflow_run trigger stays as a manual-release
382+ # fallback.
383+ - name : Dispatch npm-publish.yml
384+ env :
385+ GH_TOKEN : ${{ secrets.GITHUB_TOKEN }}
386+ run : |
387+ gh workflow run npm-publish.yml \
388+ --repo "${{ github.repository }}" \
389+ --ref main \
390+ -f version="${{ inputs.version }}"
391+ echo "Dispatched npm-publish.yml for ${{ inputs.version }}."
You can’t perform that action at this time.
0 commit comments