Skip to content

Commit fb708aa

Browse files
committed
fix: GitHub Actions PyPI publishing condition
1 parent aa26d0f commit fb708aa

File tree

1 file changed

+17
-7
lines changed

1 file changed

+17
-7
lines changed

.github/workflows/release.yml

Lines changed: 17 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
needs: full-ci
1919
runs-on: ubuntu-latest
2020
# Only publish for proper pre-release versions (PEP 440)
21-
if: contains(github.ref, 'rc') || contains(github.ref, 'a') || contains(github.ref, 'b')
21+
if: contains(github.ref_name, 'rc') || contains(github.ref_name, 'a') || contains(github.ref_name, 'b')
2222

2323
permissions:
2424
id-token: write # Required for trusted publishing
@@ -62,7 +62,7 @@ jobs:
6262
needs: publish-testpypi
6363
runs-on: ubuntu-latest
6464
# Only validate for pre-release versions that were published to TestPyPI
65-
if: contains(github.ref, 'rc') || contains(github.ref, 'a') || contains(github.ref, 'b')
65+
if: contains(github.ref_name, 'rc') || contains(github.ref_name, 'a') || contains(github.ref_name, 'b')
6666

6767
steps:
6868
- uses: actions/checkout@v4
@@ -249,16 +249,26 @@ jobs:
249249
body_path: release-notes.md
250250
draft: false
251251

252+
debug-condition:
253+
name: Debug Release Condition
254+
runs-on: ubuntu-latest
255+
steps:
256+
- name: Debug info
257+
run: |
258+
echo "github.ref = ${{ github.ref }}"
259+
echo "github.ref_name = ${{ github.ref_name }}"
260+
echo "ref contains 'a': ${{ contains(github.ref, 'a') }}"
261+
echo "ref_name contains 'a': ${{ contains(github.ref_name, 'a') }}"
262+
echo "ref_name contains '-': ${{ contains(github.ref_name, '-') }}"
263+
echo "Should publish to PyPI (new logic): ${{ !contains(github.ref_name, '-') }}"
264+
252265
publish-pypi:
253266
name: Publish to PyPI
254267
needs: full-ci
255268
runs-on: ubuntu-latest
256269
# Only publish stable versions (no pre-release suffix)
257-
# Pre-releases go to TestPyPI for now
258-
if: |
259-
!contains(github.ref, 'rc') &&
260-
!contains(github.ref, 'a') &&
261-
!contains(github.ref, 'b')
270+
# Match only versions like v0.0.1, v1.2.3, etc (no suffix)
271+
if: "!contains(github.ref_name, '-')"
262272

263273
permissions:
264274
id-token: write # Required for trusted publishing

0 commit comments

Comments
 (0)