Skip to content

Commit be93848

Browse files
aksOpsclaude
andcommitted
Fix PyPI publish: patch version from workflow input before building
pyproject.toml has version 0.0.0 (placeholder). The publish workflow now patches it with the version from the manual trigger input before building the wheel. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
1 parent dd1ac56 commit be93848

1 file changed

Lines changed: 16 additions & 1 deletion

File tree

.github/workflows/publish.yml

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,22 @@ jobs:
2929
python-version: "3.12"
3030

3131
- name: Install build tools
32-
run: pip install build
32+
run: pip install build tomli
33+
34+
- name: Patch version in pyproject.toml
35+
env:
36+
RELEASE_VERSION: ${{ inputs.version }}
37+
run: |
38+
python3 << 'PYEOF'
39+
import os, re
40+
ver = os.environ["RELEASE_VERSION"]
41+
with open("pyproject.toml", "r") as f:
42+
content = f.read()
43+
content = re.sub(r'version\s*=\s*"[^"]+"', f'version = "{ver}"', content, count=1)
44+
with open("pyproject.toml", "w") as f:
45+
f.write(content)
46+
print(f"Version set to: {ver}")
47+
PYEOF
3348
3449
- name: Build wheel and sdist
3550
run: python -m build

0 commit comments

Comments
 (0)