Skip to content

Commit 9cd1b88

Browse files
committed
chore: Update release and test workflows
1 parent c944954 commit 9cd1b88

2 files changed

Lines changed: 20 additions & 8 deletions

File tree

.github/workflows/pytest-on-each-version.yaml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,9 +6,9 @@ run-name: ${{ github.workflow }} (${{ github.ref_name }})
66
on:
77
workflow_dispatch:
88
push:
9-
branches:
10-
- 'main'
11-
- 'dev'
9+
# branches:
10+
# - 'main'
11+
# - 'dev'
1212

1313
jobs:
1414
build-linux:

.github/workflows/release-pypi.yml

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,13 @@
1-
name: Publish Python 🐍 distribution 📦 to PyPI and TestPyPI
1+
name: Publish Python 🐍 distribution 📦
22
run-name: ${{ github.workflow }} (${{ github.ref_name }})
33

44
on:
55
workflow_dispatch:
66
# FIXME: uncomment
77
push:
88
tags:
9-
- "v[0-9]+.[0-9]+.[0-9]+"
9+
- "v[0-9]+.[0-9]+.[0-9]+"
10+
- "v[0-9]+.[0-9]+.[0-9]+-*"
1011

1112
jobs:
1213
build:
@@ -31,7 +32,8 @@ jobs:
3132
publish-to-pypi:
3233
name: >-
3334
Publish Python 🐍 distribution 📦 to PyPI
34-
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
35+
# Only publish to PyPI on tag pushes with version tags or release candidates
36+
if: startsWith(github.ref, 'refs/tags/') && (!contains(github.ref_name, '-') || contains(github.ref_name, 'rc'))
3537
needs:
3638
- build
3739
runs-on: ubuntu-latest
@@ -53,7 +55,8 @@ jobs:
5355
name: >-
5456
Sign the Python 🐍 distribution 📦 with Sigstore
5557
and upload them to GitHub Release
56-
if: startsWith(github.ref, 'refs/tags/') # only publish to PyPI on tag pushes
58+
# only publish to PyPI on tag pushes
59+
if: startsWith(github.ref, 'refs/tags/')
5760
needs:
5861
- build
5962
runs-on: ubuntu-latest
@@ -69,11 +72,19 @@ jobs:
6972
name: python-package-distributions
7073
path: dist/
7174
- name: Sign the dists with Sigstore
72-
uses: sigstore/gh-action-sigstore-python@v2.1.1
75+
uses: sigstore/gh-action-sigstore-python@v3.0.0
7376
with:
7477
inputs: >-
7578
./dist/*.tar.gz
7679
./dist/*.whl
80+
- name: Determine if pre-release
81+
id: prerelease
82+
run: |
83+
if [[ "${GITHUB_REF#refs/tags/}" == *-* ]]; then
84+
echo "pre_release=true" >> $GITHUB_OUTPUT
85+
else
86+
echo "pre_release=false" >> $GITHUB_OUTPUT
87+
fi
7788
- name: Create GitHub Release
7889
env:
7990
GITHUB_TOKEN: ${{ github.token }}
@@ -82,6 +93,7 @@ jobs:
8293
'${{ github.ref_name }}'
8394
--repo '${{ github.repository }}'
8495
--generate-notes
96+
--prerelease=${{ steps.prerelease.outputs.pre_release }}
8597
- name: Upload artifact signatures to GitHub Release
8698
env:
8799
GITHUB_TOKEN: ${{ github.token }}

0 commit comments

Comments
 (0)