This commit is contained in:
Manuel Fritsch 2021-02-07 13:52:03 +01:00
parent af6978ca2f
commit 0f295e25c6
3 changed files with 57 additions and 2 deletions

View file

@ -1 +1 @@
__version__ = "4.0.0.16" __version__ = "4.0.0.17"

54
release.py Normal file
View file

@ -0,0 +1,54 @@
import subprocess
import click
import re
@click.group()
def main():
pass
@click.command()
@click.option('-m', prompt='Commit Message')
def commit(m):
file = "./cbpi/__init__.py"
with open(file) as reader:
match = re.search('.*\"(.*)\"', reader.readline())
major, minor, patch, build = match.group(1).split(".")
build = int(build)
build += 1
new_version = "__version__ = \"{}.{}.{}.{}\"".format(major,minor,patch, build)
with open(file,'w',encoding = 'utf-8') as file:
print("New Version {}".format(new_version) )
file.write(new_version)
subprocess.run(["git", "add", "-A"])
subprocess.run(["git", "commit", "-m", "\"{}\"".format(m)])
subprocess.run(["git", "push"])
@click.command()
def build():
subprocess.run(["python3", "setup.py", "sdist"])
@click.command()
def release():
subprocess.run(["python3", "setup.py", "sdist"])
file = "./cbpi/__init__.py"
with open(file) as reader:
match = re.search('.*\"(.*)\"', reader.readline())
version = match.group(1)
path = "dist/cbpi-{}.tar.gz".format(version)
print("Uploading File {} ".format(path))
subprocess.run(["twine", "upload", path])
main.add_command(commit)
main.add_command(release)
main.add_command(build)
if __name__ == '__main__':
main()

View file

@ -13,5 +13,6 @@ pyfiglet==0.8.post1
pandas==1.1.5 pandas==1.1.5
shortuuid==1.0.1 shortuuid==1.0.1
tabulate==0.8.7 tabulate==0.8.7
cbpi4-ui cbpi4ui
click
asyncio-mqtt asyncio-mqtt