We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 22b568b commit 46d3251Copy full SHA for 46d3251
.github/workflows/python-publish.yml
@@ -26,6 +26,22 @@ jobs:
26
python -m pip install --upgrade pip
27
pip install build twine
28
29
+ - name: Set version from tag
30
+ run: |
31
+ # Extract tag name without 'v' prefix if present
32
+ VERSION=${GITHUB_REF#refs/tags/}
33
+ VERSION=${VERSION#v}
34
+ # Update version in setup.py, pyproject.toml or __init__.py
35
+ if [ -f "setup.py" ]; then
36
+ sed -i "s/version=['\"][^'\"]*['\"]/version='${VERSION}'/g" setup.py
37
+ fi
38
+ if [ -f "pyproject.toml" ]; then
39
+ sed -i "s/version = \"[^\"]*\"/version = \"${VERSION}\"/g" pyproject.toml
40
41
+ if [ -f "__init__.py" ]; then
42
+ sed -i "s/__version__ = ['\"][^'\"]*['\"]/__version__ = '${VERSION}'/g" __init__.py
43
44
+
45
- name: Build package
46
run: python -m build
47
0 commit comments