Skip to content

Commit 5cbc97a

Browse files
Append .devN version suffix for TestPyPI uploads
On push to main, the build step reads the current version from pyproject.toml and appends .devN (where N = GITHUB_RUN_NUMBER) before building. This produces unique, PEP 440-compliant developmental release versions (e.g. 0.1.0.dev42) for TestPyPI. For release events, the version is used as-is for PyPI. Co-authored-by: deviantintegral <255023+deviantintegral@users.noreply.github.com>
1 parent f5b714a commit 5cbc97a

1 file changed

Lines changed: 9 additions & 0 deletions

File tree

‎.github/workflows/publish-to-pypi.yml‎

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,15 @@ jobs:
2323
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
2424
with:
2525
python-version: "3.13"
26+
- name: Set dev version for TestPyPI
27+
if: github.event_name == 'push'
28+
run: |
29+
CURRENT_VERSION=$(python -c "
30+
import tomllib
31+
with open('pyproject.toml', 'rb') as f:
32+
print(tomllib.load(f)['project']['version'])
33+
")
34+
sed -i "s/^version = \".*\"/version = \"${CURRENT_VERSION}.dev${GITHUB_RUN_NUMBER}\"/" pyproject.toml
2635
- run: uv build
2736
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
2837
with:

0 commit comments

Comments
 (0)