Skip to content

Commit cd8dbcc

Browse files
authored
Merge pull request #32 from ahebrank/restore-version
back to version file
2 parents 6ef6ae7 + 07e9378 commit cd8dbcc

File tree

5 files changed

+46
-15
lines changed

5 files changed

+46
-15
lines changed

.github/workflows/publish.yml

+8-11
Original file line numberDiff line numberDiff line change
@@ -15,26 +15,23 @@ jobs:
1515
run: |
1616
# from refs/tags/1.2.3 get 1.2.3
1717
VERSION=$( basename $GITHUB_REF )
18-
PLACEHOLDER='version="develop"'
19-
VERSION_FILE='setup.py'
18+
PLACEHOLDER='__version__ = "0.0.0"'
19+
VERSION_FILE='gwh/__version__.py'
2020
# fail out if placeholder not found
2121
grep "$PLACEHOLDER" "$VERSION_FILE"
22-
sed -i "s/$PLACEHOLDER/version=\"${VERSION}\"/" "$VERSION_FILE"
22+
sed -i "s/$PLACEHOLDER/__version__ = \"${VERSION}\"/" "$VERSION_FILE"
2323
shell: bash
2424

25+
- name: install, test cli
26+
run: |
27+
pip3 install .
28+
python3 -m gwh --help
29+
2530
- name: install dependencies & build
2631
run: |
2732
pip3 install setuptools wheel
2833
python3 setup.py sdist bdist_wheel
2934
30-
- name: publish to Test PyPi
31-
uses: pypa/gh-action-pypi-publish@release/v1
32-
with:
33-
skip_existing: true
34-
user: __token__
35-
password: ${{ secrets.TEST_PYPI_TOKEN }}
36-
repository_url: https://test.pypi.org/legacy/
37-
3835
- name: publish to PyPi
3936
if: startsWith(github.ref, 'refs/tags')
4037
uses: pypa/gh-action-pypi-publish@release/v1

.github/workflows/test.yml

+26
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,26 @@
1+
on: [push, pull_request]
2+
3+
jobs:
4+
publish:
5+
name: build and publish to testpypi
6+
runs-on: ubuntu-latest
7+
steps:
8+
- uses: actions/checkout@v2
9+
10+
- name: install, test cli
11+
run: |
12+
pip3 install .
13+
python3 -m gwh --help
14+
15+
- name: install dependencies & build
16+
run: |
17+
pip3 install setuptools wheel
18+
python3 setup.py sdist bdist_wheel
19+
20+
- name: publish to Test PyPi
21+
uses: pypa/gh-action-pypi-publish@release/v1
22+
with:
23+
skip_existing: true
24+
user: __token__
25+
password: ${{ secrets.TEST_PYPI_TOKEN }}
26+
repository_url: https://test.pypi.org/legacy/

gwh/__main__.py

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
import json
33

44
from .__version__ import (
5-
__title__,
5+
__package__,
66
__version__
77
)
88
from gwh import app
@@ -11,7 +11,7 @@
1111
if __name__ == "__main__":
1212
parser = argparse.ArgumentParser(prog="python -m gwh", description="GitLab webhook handler")
1313
parser.add_argument("config", help="path to repos configuration")
14-
parser.add_argument("--version", action="version", version=__title__ + " " + __version__)
14+
parser.add_argument("--version", action="version", version=__package__ + " " + __version__)
1515
parser.add_argument("--host", help="server host", default="0.0.0.0")
1616
parser.add_argument("-p", "--port", help="server port", type=int, default=8080)
1717
parser.add_argument("--allow", help="whitelist GitLab IP block")

gwh/__version__.py

+3
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
__package__ = "gwh"
2+
# version is injected at build, do not change here
3+
__version__ = "0.0.0"

setup.py

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,14 @@
11
import os
22
from setuptools import setup
33

4+
about = {}
5+
here = os.path.abspath(os.path.dirname(__file__))
6+
with open(os.path.join(here, 'gwh', '__version__.py'), encoding='utf-8') as f:
7+
exec(f.read(), about)
8+
49
setup(
5-
name="gwh",
6-
version="develop",
10+
name=about['__package__'],
11+
version=about['__version__'],
712
author='Andy Hebrank',
813
author_email='[email protected]',
914
packages=['gwh'],

0 commit comments

Comments
 (0)