Skip to content

Commit

Permalink
auto update version when release created
Browse files Browse the repository at this point in the history
  • Loading branch information
sanyatuning committed Mar 6, 2020
1 parent 7e32718 commit 0e3daf2
Show file tree
Hide file tree
Showing 4 changed files with 20 additions and 0 deletions.
1 change: 1 addition & 0 deletions .github/workflows/pythonpublish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,6 @@ jobs:
TWINE_USERNAME: ${{ secrets.PYPI_USERNAME }}
TWINE_PASSWORD: ${{ secrets.PYPI_PASSWORD }}
run: |
python version.py ${{ github.ref }}
python setup.py sdist bdist_wheel
twine upload dist/*
4 changes: 4 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -78,3 +78,7 @@ ENV/
# macOS stuff
.DS_Store
._.DS_Store

# project specific
*.bak
*.db
14 changes: 14 additions & 0 deletions version.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,14 @@
import fileinput
import os
import re
import sys

parts = sys.argv[1].replace('v', '').split('.')
dir = os.path.dirname(os.path.realpath(__file__))

with fileinput.FileInput(dir + '/zigpy_cc/__init__.py', inplace=True, backup='.bak') as file:
for line in file:
line = re.sub(r'(MAJOR_VERSION =).*', '\\1 ' + parts[0], line)
line = re.sub(r'(MINOR_VERSION =).*', '\\1 ' + parts[1], line)
line = re.sub(r'(PATCH_VERSION =).*', '\\1 ' + parts[2], line)
print(line, end='')
1 change: 1 addition & 0 deletions zigpy_cc/__init__.py
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
# This file updated automatically before PyPI release was created
MAJOR_VERSION = 0
MINOR_VERSION = 2
PATCH_VERSION = "0"
Expand Down

0 comments on commit 0e3daf2

Please sign in to comment.