Skip to content

Commit 2dc817a

Browse files
isidore4dsherwoodSwamyDev
committed
e version file for auto update on release
Co-Authored-By: 4dsherwood <10386643+4dsherwood@users.noreply.github.com> Co-Authored-By: Bernhard Raml <1769280+SwamyDev@users.noreply.github.com>
1 parent cd3682f commit 2dc817a

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

.github/workflows/publish.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,14 @@ jobs:
1515
uses: actions/setup-python@v2
1616
with:
1717
python-version: '3.x'
18+
- name: Determine version from git tag
19+
id: version
20+
run: echo ::set-output name=tag::${GITHUB_REF#refs/*/}
21+
22+
- name: set version
23+
run: |
24+
rm ./version.py
25+
echo version_number = \"${{ steps.version.outputs.tag }}\" > ./version.py
1826
- name: Install dependencies
1927
run: |
2028
python -m pip install --upgrade pip

setup.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,17 +3,24 @@
33

44
import os
55
import codecs
6+
import re
7+
from pathlib import Path
8+
69
from setuptools import setup
710

811

912
def read(fname):
1013
file_path = os.path.join(os.path.dirname(__file__), fname)
1114
return codecs.open(file_path, encoding='utf-8').read()
1215

16+
HERE = Path(__file__).parent
17+
_version_file_contents = (HERE / "version.py").read_text()
18+
matched = re.search(r'"(.*)"', _version_file_contents)
19+
VERSION = matched.group(1) if matched is not None else "UNKNOWN VERSION"
1320

1421
setup(
1522
name='pytest-approvaltests',
16-
version='0.2.3',
23+
version=VERSION,
1724
author='Emily Bache',
1825
author_email='emily@bacheconsulting.com',
1926
maintainer='Emily Bache',

version.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1 @@
1+
version_number = "v5.0.1"

0 commit comments

Comments
 (0)