Skip to content

Commit 5b98d27

Browse files
claudesdimitro
authored andcommitted
Fix release workflow triggering from cut-release
Tags pushed by GitHub Actions using GITHUB_TOKEN don't trigger other workflows. Fix this by: - Adding workflow_call trigger to release.yml with version input - Having cut-release.yml directly call release.yml after creating the tag - Updating release.yml checkout steps to use the version input/ref - Adding id-token permission for PyPI trusted publishing https://claude.ai/code/session_01EbCZH6NCwRCDVVgu68bc9L
1 parent 4690b95 commit 5b98d27

File tree

2 files changed

+27
-5
lines changed

2 files changed

+27
-5
lines changed

.github/workflows/cut-release.yml

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@ on:
1010

1111
permissions:
1212
contents: write
13+
id-token: write # Required for PyPI trusted publishing
1314

1415
jobs:
1516
cut-release:
@@ -66,6 +67,11 @@ jobs:
6667
run: |
6768
echo "## Release $VERSION created!" >> $GITHUB_STEP_SUMMARY
6869
echo "" >> $GITHUB_STEP_SUMMARY
69-
echo "The tag \`$VERSION\` has been pushed and will trigger the release workflow." >> $GITHUB_STEP_SUMMARY
70-
echo "" >> $GITHUB_STEP_SUMMARY
71-
echo "Check the [Release workflow](/${{ github.repository }}/actions/workflows/release.yml) for progress." >> $GITHUB_STEP_SUMMARY
70+
echo "Tag \`$VERSION\` has been pushed. Release workflow will now run." >> $GITHUB_STEP_SUMMARY
71+
72+
release:
73+
name: Release
74+
needs: cut-release
75+
uses: ./.github/workflows/release.yml
76+
with:
77+
version: ${{ github.event.inputs.version }}

.github/workflows/release.yml

Lines changed: 18 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,16 @@ on:
55
tags:
66
- 'v[0-9]+.[0-9]+.[0-9]+'
77
- 'v[0-9]+.[0-9]+.[0-9]+-*' # Allow pre-release tags like v0.2.0-beta1
8+
workflow_call:
9+
inputs:
10+
version:
11+
description: 'Version tag to release (e.g., v0.2.0)'
12+
required: true
13+
type: string
14+
15+
env:
16+
# Use input version for workflow_call, or ref_name for tag push
17+
RELEASE_VERSION: ${{ inputs.version || github.ref_name }}
818

919
jobs:
1020
build:
@@ -13,6 +23,8 @@ jobs:
1323

1424
steps:
1525
- uses: actions/checkout@v4
26+
with:
27+
ref: ${{ inputs.version || github.ref_name }}
1628

1729
- name: Set up Python
1830
uses: actions/setup-python@v5
@@ -38,6 +50,8 @@ jobs:
3850

3951
steps:
4052
- uses: actions/checkout@v4
53+
with:
54+
ref: ${{ inputs.version || github.ref_name }}
4155

4256
- name: Set up Python
4357
uses: actions/setup-python@v5
@@ -88,6 +102,8 @@ jobs:
88102

89103
steps:
90104
- uses: actions/checkout@v4
105+
with:
106+
ref: ${{ inputs.version || github.ref_name }}
91107

92108
- name: Download distribution artifacts
93109
uses: actions/download-artifact@v4
@@ -99,7 +115,7 @@ jobs:
99115
env:
100116
GITHUB_TOKEN: ${{ github.token }}
101117
run: |
102-
gh release create '${{ github.ref_name }}' \
103-
--title '${{ github.ref_name }}' \
118+
gh release create '${{ env.RELEASE_VERSION }}' \
119+
--title '${{ env.RELEASE_VERSION }}' \
104120
--generate-notes \
105121
dist/*

0 commit comments

Comments
 (0)