mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-26 12:53:12 -06:00
Actions: Attempt to set TWBlue version based in pushed tag
This commit is contained in:
parent
3a867f0b82
commit
f8d3dfc37f
@ -2,15 +2,10 @@
|
|||||||
""" Write version info (taken from the last commit) to application.py. This method has been implemented this way for running updates.
|
""" Write version info (taken from the last commit) to application.py. This method has been implemented this way for running updates.
|
||||||
This file is not intended to be called by the user. It will be used only by the Gitlab CI runner."""
|
This file is not intended to be called by the user. It will be used only by the Gitlab CI runner."""
|
||||||
import os
|
import os
|
||||||
import requests
|
|
||||||
from codecs import open
|
from codecs import open
|
||||||
|
|
||||||
print("Writing version data for update...")
|
print("Writing version data for update...")
|
||||||
commit_info = requests.get("https://gitlab.com/api/v4/projects/23482196/repository/commits/next-gen")
|
new_version = os.environ.get("GITHUB_REF_NAME")
|
||||||
commit_info = commit_info.json()
|
|
||||||
commit = commit_info["short_id"]
|
|
||||||
print("Got new version info: {commit}".format(commit=commit,))
|
|
||||||
new_version = commit_info["created_at"][:10].replace("-", ".")
|
|
||||||
file = open("application.py", "r", encoding="utf-8")
|
file = open("application.py", "r", encoding="utf-8")
|
||||||
lines = file.readlines()
|
lines = file.readlines()
|
||||||
lines[-1] = 'version = "{}"'.format(new_version)
|
lines[-1] = 'version = "{}"'.format(new_version)
|
||||||
@ -29,9 +24,3 @@ file2 = open("..\\scripts\\twblue.nsi", "w", encoding="utf-8")
|
|||||||
file2.write(contents)
|
file2.write(contents)
|
||||||
file2.close()
|
file2.close()
|
||||||
print("done")
|
print("done")
|
||||||
|
|
||||||
print("Writing new version to version.txt")
|
|
||||||
version_txt = open("../version.txt", "w", encoding="utf8")
|
|
||||||
version_txt.write(new_version)
|
|
||||||
version_txt.close()
|
|
||||||
print("Done.")
|
|
||||||
|
Loading…
Reference in New Issue
Block a user