Skip to content

Commit ede09e2

Browse files
authored
Added workflow for release branches (#3)
* Added automatic versioning * Push to test pypi on release branch pushes
1 parent c13a6e6 commit ede09e2

3 files changed

Lines changed: 6 additions & 11 deletions

File tree

.github/workflows/publish-to-test-pypi.yml

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
name: Publish Python 🐍 distributions 📦 to PyPI and TestPyPI
2-
on: push
2+
on:
3+
push:
4+
branches:
5+
- 'releases/**'
36
jobs:
47
build-n-publish:
58
name: Build and publish Python 🐍 distributions 📦 to PyPI and TestPyPI
@@ -28,7 +31,6 @@ jobs:
2831
with:
2932
password: ${{ secrets.TEST_PYPI_API_TOKEN }}
3033
repository_url: https://test.pypi.org/legacy/
31-
skip_existing: true
3234
# - name: Publish distribution 📦 to PyPI
3335
# if: startsWith(github.ref, 'refs/tags')
3436
# uses: pypa/gh-action-pypi-publish@master

geocachingapi/__version__.py

Lines changed: 0 additions & 2 deletions
This file was deleted.

setup.py

Lines changed: 2 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -6,12 +6,6 @@
66
with open("README.md", "r") as fh:
77
long_description = fh.read()
88

9-
def get_version():
10-
"""Get current version from code."""
11-
regex = r"__version__\s=\s\"(?P<version>[\d\.]+?)\""
12-
path = ("geocachingapi", "__version__.py")
13-
return re.search(regex, read(*path)).group("version")
14-
159
def read(*parts):
1610
"""Read file."""
1711
filename = os.path.join(os.path.abspath(os.path.dirname(__file__)), *parts)
@@ -21,7 +15,6 @@ def read(*parts):
2115

2216
setuptools.setup(
2317
name="geocachingapi",
24-
version=get_version(),
2518
author="Rudolf Offereins",
2619
author_email="r.offereins@gmail.com",
2720
description="Python client for controlling the Geocaching API",
@@ -47,4 +40,6 @@ def read(*parts):
4740
python_requires='>=3.8',
4841
zip_safe=False,
4942
include_package_data=True,
43+
use_scm_version=True,
44+
setup_requires=['setuptools_scm']
5045
)

0 commit comments

Comments
 (0)