Skip to content

Commit e5955ce

Browse files
author
Marian Ganisin
committed
Version definition as part of build process
1 parent 45e2f3f commit e5955ce

File tree

3 files changed

+4
-6
lines changed

3 files changed

+4
-6
lines changed

.github/workflows/release.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@ jobs:
1212
with:
1313
python-version: '3.7'
1414
- name: build
15-
run: python setup.py sdist bdist_wheel
15+
run: python setup.py ${GITHUB_REF#refs/tags/v} sdist bdist_wheel
1616
- name: release
1717
uses: pypa/gh-action-pypi-publish@master
1818
with:

setup.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,13 @@
1-
import io
21
import re
2+
import sys
33

44
from setuptools import find_packages, setup
55

66
with open("README.md", "r") as fh:
77
long_description = fh.read()
88

9-
with io.open('threescale_api/__init__.py', 'rt', encoding='utf8') as f:
10-
VERSION = re.search(r'__version__ = \'(.*?)\'', f.read()).group(1)
9+
VERSION = sys.argv.pop(1)
10+
assert re.match(r"[0-9]+\.[0-9]+\.[0-9]+", VERSION), "Version definition required as first arg"
1111

1212
requirements = ['requests']
1313

threescale_api/__init__.py

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,2 @@
11
# flake8: noqa
22
from .client import ThreeScaleClient
3-
4-
__version__ = '0.15.0'

0 commit comments

Comments
 (0)