Skip to content

Commit d38c99b

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 8cc9b7d commit d38c99b

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
@@ -17,6 +17,15 @@ jobs:
1717
- uses: actions/setup-python@a309ff8b426b58ec0e2a45f0f869d46889d02405 # v6
1818
with:
1919
python-version: "3.13"
20+
- name: Set dev version for TestPyPI
21+
if: github.event_name == 'push'
22+
run: |
23+
CURRENT_VERSION=$(python -c "
24+
import tomllib
25+
with open('pyproject.toml', 'rb') as f:
26+
print(tomllib.load(f)['project']['version'])
27+
")
28+
sed -i "s/^version = \".*\"/version = \"${CURRENT_VERSION}.dev${GITHUB_RUN_NUMBER}\"/" pyproject.toml
2029
- run: uv build
2130
- uses: actions/upload-artifact@b7c566a772e6b6bfb58ed0dc250532a479d7789f # v6.0.0
2231
with:

0 commit comments

Comments
 (0)