Skip to content

Commit 66e3cc2

Browse files
sdk auto-release: invoke publish.yml via workflow_call (#172)
GitHub Actions deliberately does not trigger downstream workflows on events created by a workflow's default GITHUB_TOKEN, to prevent recursive loops. So when auto-release-on-version-bump used `gh release create` to publish a Release, the `release: published` event silently did NOT trigger publish.yml. v3.8.2 sat with a Release object but never published to npm/PyPI. Fix: explicitly invoke publish.yml via workflow_call from auto-release, after the Release is created. publish.yml grows a workflow_call trigger alongside `release: published`, accepting a `tag` input. Every reference to `github.event.release.tag_name` is now `${{ inputs.tag || github.event.release.tag_name }}` so both trigger paths work. The release env approval gate still applies (workflow_call propagates the env protection). The OIDC publishing model is unchanged.
1 parent 962902c commit 66e3cc2

2 files changed

Lines changed: 28 additions & 6 deletions

File tree

.github/workflows/auto-release-on-version-bump.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -32,6 +32,10 @@ jobs:
3232
runs-on: ubuntu-latest
3333
permissions:
3434
contents: write # required to create the Release/tag
35+
outputs:
36+
should_release: ${{ steps.detect.outputs.should_release }}
37+
version: ${{ steps.detect.outputs.version }}
38+
tag: v${{ steps.detect.outputs.version }}
3539

3640
steps:
3741
- name: Checkout (full history for range-aware diff)
@@ -225,3 +229,15 @@ jobs:
225229
exit 0
226230
fi
227231
echo "Created Release v${VERSION}. publish.yml takes over from here."
232+
233+
publish:
234+
name: Publish (via release env approval gate)
235+
needs: detect-and-release
236+
if: needs.detect-and-release.outputs.should_release == 'true'
237+
uses: ./.github/workflows/publish.yml
238+
with:
239+
tag: ${{ needs.detect-and-release.outputs.tag }}
240+
secrets: inherit
241+
permissions:
242+
contents: read
243+
id-token: write # required for OIDC publishing (cascades to the called workflow)

.github/workflows/publish.yml

Lines changed: 12 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -4,12 +4,18 @@ name: publish
44
# Release runs are serialized via the concurrency group below so two simultaneous
55
# release publishes can't race on registry uploads.
66
concurrency:
7-
group: publish-${{ github.event.release.tag_name || github.run_id }}
7+
group: publish-${{ inputs.tag || github.event.release.tag_name || github.run_id }}
88
cancel-in-progress: false
99

1010
on:
1111
release:
1212
types: [published]
13+
workflow_call:
14+
inputs:
15+
tag:
16+
description: 'Release tag to publish (e.g. v3.8.3)'
17+
required: true
18+
type: string
1319

1420
# Default permissions: read-only. Individual jobs override what they need.
1521
permissions:
@@ -27,7 +33,7 @@ jobs:
2733
- name: Checkout
2834
uses: actions/checkout@v4
2935
with:
30-
ref: ${{ github.event.release.tag_name }}
36+
ref: ${{ inputs.tag || github.event.release.tag_name }}
3137
fetch-depth: 0
3238

3339
- name: Verify release environment is protected (fail-closed)
@@ -56,7 +62,7 @@ jobs:
5662
- name: Extract release tag and verify version coherence
5763
id: version
5864
env:
59-
RELEASE_TAG: ${{ github.event.release.tag_name }}
65+
RELEASE_TAG: ${{ inputs.tag || github.event.release.tag_name }}
6066
run: |
6167
set -euo pipefail
6268
# Strip optional leading 'v'.
@@ -136,7 +142,7 @@ jobs:
136142
- name: Record approver from deployment review log
137143
env:
138144
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
139-
RELEASE_TAG: ${{ github.event.release.tag_name }}
145+
RELEASE_TAG: ${{ inputs.tag || github.event.release.tag_name }}
140146
TARGET_VERSION: ${{ needs.preflight.outputs.version }}
141147
run: |
142148
set -euo pipefail
@@ -164,7 +170,7 @@ jobs:
164170
- name: Checkout
165171
uses: actions/checkout@v4
166172
with:
167-
ref: ${{ github.event.release.tag_name }}
173+
ref: ${{ inputs.tag || github.event.release.tag_name }}
168174

169175
- name: Install uv
170176
uses: astral-sh/setup-uv@v6
@@ -193,7 +199,7 @@ jobs:
193199
- name: Checkout
194200
uses: actions/checkout@v4
195201
with:
196-
ref: ${{ github.event.release.tag_name }}
202+
ref: ${{ inputs.tag || github.event.release.tag_name }}
197203

198204
- name: Setup pnpm
199205
uses: pnpm/action-setup@v4

0 commit comments

Comments
 (0)