Skip to content

Commit 0d93246

Browse files
committed
Enhance nightly PyPI publish workflow triggers
Summary: This commit updates the nightly PyPI publish workflow to include additional triggers for publishing. It now allows publishing on tag pushes, specifically for versioned tags (e.g., "v*" and "*.*.*"), in addition to the existing scheduled runs. Changes: - Added `push` triggers for versioned tags in `.github/workflows/nightly-pypi.yml`. - Modified conditions for building and publishing to accommodate tag events. This enhancement improves the flexibility of the publishing process, enabling immediate releases upon tagging.
1 parent 3ff7ac6 commit 0d93246

File tree

1 file changed

+10
-3
lines changed

1 file changed

+10
-3
lines changed

.github/workflows/nightly-pypi.yml

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,10 @@ on:
33
schedule:
44
- cron: "8 7 * * *" # 07:08 UTC daily
55
workflow_dispatch: {} # allow manual runs (no publish)
6+
push:
7+
tags:
8+
- "v*"
9+
- "*.*.*"
610

711
permissions:
812
contents: read
@@ -27,15 +31,18 @@ jobs:
2731
2832
- name: Compute nightly version from latest tag (per-second)
2933
id: ver
34+
if: github.ref_type != 'tag'
3035
run: |
3136
TAG=$(git describe --tags --abbrev=0 2>/dev/null || echo 0.1.0)
3237
BASE=${TAG#v}
3338
DATE=$(date -u +%Y%m%d%H%M%S)
3439
echo "NVER=${BASE}.dev${DATE}" >> $GITHUB_OUTPUT
3540
36-
- name: Build sdist/wheel with forced version
41+
- name: Build sdist/wheel
3742
run: |
38-
export SETUPTOOLS_SCM_PRETEND_VERSION=${{ steps.ver.outputs.NVER }}
43+
if [ "${GITHUB_REF_TYPE}" != "tag" ]; then
44+
export SETUPTOOLS_SCM_PRETEND_VERSION=${{ steps.ver.outputs.NVER }}
45+
fi
3946
python -m build
4047
4148
- name: Check metadata
@@ -44,7 +51,7 @@ jobs:
4451
twine check dist/*
4552
4653
- name: Publish to PyPI (API token)
47-
if: github.event_name == 'schedule'
54+
if: github.event_name == 'schedule' || github.ref_type == 'tag'
4855
uses: pypa/gh-action-pypi-publish@release/v1
4956
with:
5057
user: __token__

0 commit comments

Comments
 (0)