Skip to content

Commit 68e3ca9

Browse files
fsecada01claude
andcommitted
fix: trigger build/publish jobs on tag pushes and release branches
The build, create_release, and publish_pypi jobs were conditioned only on refs/heads/release/* so they were silently skipped when triggered by a v* tag push. Also fixes version extraction to handle both ref types. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
1 parent 63f2811 commit 68e3ca9

1 file changed

Lines changed: 12 additions & 9 deletions

File tree

.github/workflows/release.yml

Lines changed: 12 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,7 @@ jobs:
8282
name: Build Package
8383
needs: lint_test # Depends on successful linting and testing
8484
# Only run this job on direct pushes to release/* branches, not on PRs
85-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/')
85+
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/'))
8686
runs-on: ubuntu-latest
8787
steps:
8888
- name: Checkout code
@@ -114,8 +114,8 @@ jobs:
114114
create_release:
115115
name: Create GitHub Release
116116
needs: build # Depends on successful build
117-
# Only run this job on direct pushes to release/* branches
118-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/')
117+
# Only run this job on direct pushes to release/* branches or version tags
118+
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/'))
119119
runs-on: ubuntu-latest
120120
permissions:
121121
contents: write # Required to create releases and tags
@@ -129,11 +129,14 @@ jobs:
129129
name: python-package-distributions
130130
path: dist
131131

132-
- name: Extract version from branch name
132+
- name: Extract version from ref
133133
id: get_version
134-
# Assumes branch name is like 'release/v1.2.3'
135-
# Extracts 'v1.2.3' as the tag name
136-
run: echo "TAG_NAME=${GITHUB_REF#refs/heads/release/}" >> $GITHUB_OUTPUT
134+
# Works for both 'refs/heads/release/v1.2.3' and 'refs/tags/v1.2.3'
135+
run: |
136+
REF="${GITHUB_REF}"
137+
TAG="${REF#refs/heads/release/}"
138+
TAG="${TAG#refs/tags/}"
139+
echo "TAG_NAME=${TAG}" >> $GITHUB_OUTPUT
137140
138141
- name: Create GitHub Release
139142
uses: softprops/action-gh-release@v2
@@ -154,8 +157,8 @@ jobs:
154157
publish_pypi:
155158
name: Publish to PyPI
156159
needs: create_release # Depends on successful release creation
157-
# Only run this job on direct pushes to release/* branches
158-
if: github.event_name == 'push' && startsWith(github.ref, 'refs/heads/release/')
160+
# Only run this job on direct pushes to release/* branches or version tags
161+
if: github.event_name == 'push' && (startsWith(github.ref, 'refs/heads/release/') || startsWith(github.ref, 'refs/tags/'))
159162
runs-on: ubuntu-latest
160163
environment: # Optional: Define environment for PyPI publishing rules/secrets
161164
name: pypi

0 commit comments

Comments
 (0)