Skip to content

Commit 13c2da1

Browse files
authored
Set the package version automatically (#199)
1 parent 02dac3b commit 13c2da1

2 files changed

Lines changed: 10 additions & 1 deletion

File tree

.circleci/config.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,14 @@ jobs:
8080
setuptools==69.0.3 \
8181
wheel==0.42.0 \
8282
twine==5.1.1
83+
84+
# Extract version from git tag
85+
if [[ -n "${CIRCLE_TAG}" ]]; then
86+
PACKAGE_VERSION="${CIRCLE_TAG}"
87+
export PACKAGE_VERSION
88+
echo "Building version: $PACKAGE_VERSION from tag: $CIRCLE_TAG"
89+
fi
90+
8391
python setup.py sdist bdist_wheel
8492
twine check dist/*
8593
- persist_to_workspace:

setup.py

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
#!/usr/bin/env python
22

3+
import os
34
import os.path
45

56
import setuptools
@@ -10,7 +11,7 @@
1011
os.path.join(os.path.abspath(os.path.dirname(__file__)),
1112
'README.md')).read(),
1213
long_description_content_type="text/markdown",
13-
version='1.2.2',
14+
version=os.environ.get('PACKAGE_VERSION', '0.0.0'),
1415
description='Restic backup Python wrapper',
1516
project_urls={
1617
"repository": "https://github.com/mtlynch/resticpy",

0 commit comments

Comments
 (0)