mirror of
https://github.com/meshtastic/protobufs.git
synced 2026-04-20 22:13:55 +00:00
Github action for automated tagging (release)
This commit is contained in:
parent
5ddb7cbbe7
commit
1da871fb2f
5 changed files with 115 additions and 1 deletions
8
scripts/buildinfo.py
Executable file
8
scripts/buildinfo.py
Executable file
|
|
@ -0,0 +1,8 @@
|
|||
#!/usr/bin/env python3
|
||||
import configparser
|
||||
import sys
|
||||
from readprops import readProps
|
||||
|
||||
verObj = readProps('version.properties')
|
||||
propName = sys.argv[1]
|
||||
print(f"{verObj[propName]}")
|
||||
16
scripts/bump_version.py
Executable file
16
scripts/bump_version.py
Executable file
|
|
@ -0,0 +1,16 @@
|
|||
#!/usr/bin/env python
|
||||
"""Bump the version number"""
|
||||
|
||||
lines = None
|
||||
|
||||
with open('version.properties', 'r', encoding='utf-8') as f:
|
||||
lines = f.readlines()
|
||||
|
||||
with open('version.properties', 'w', encoding='utf-8') as f:
|
||||
for line in lines:
|
||||
if line.lstrip().startswith("build = "):
|
||||
words = line.split(" = ")
|
||||
ver = f'build = {int(words[1]) + 1}'
|
||||
f.write(f'{ver}\n')
|
||||
else:
|
||||
f.write(line)
|
||||
35
scripts/readprops.py
Normal file
35
scripts/readprops.py
Normal file
|
|
@ -0,0 +1,35 @@
|
|||
import subprocess
|
||||
import configparser
|
||||
import traceback
|
||||
import sys
|
||||
|
||||
|
||||
def readProps(prefsLoc):
|
||||
"""Read the version of our project as a string"""
|
||||
|
||||
config = configparser.RawConfigParser()
|
||||
config.read(prefsLoc)
|
||||
version = dict(config.items('VERSION'))
|
||||
verObj = dict(short = "{}.{}.{}".format(version["major"], version["minor"], version["build"]),
|
||||
long = "unset")
|
||||
|
||||
# Try to find current build SHA if if the workspace is clean. This could fail if git is not installed
|
||||
try:
|
||||
sha = subprocess.check_output(
|
||||
['git', 'rev-parse', '--short', 'HEAD']).decode("utf-8").strip()
|
||||
isDirty = subprocess.check_output(
|
||||
['git', 'diff', 'HEAD']).decode("utf-8").strip()
|
||||
suffix = sha
|
||||
if isDirty:
|
||||
# short for 'dirty', we want to keep our verstrings source for protobuf reasons
|
||||
suffix = sha + "-d"
|
||||
verObj['long'] = "{}.{}.{}.{}".format(
|
||||
version["major"], version["minor"], version["build"], suffix)
|
||||
except:
|
||||
# print("Unexpected error:", sys.exc_info()[0])
|
||||
# traceback.print_exc()
|
||||
verObj['long'] = verObj['short']
|
||||
|
||||
# print("firmware version " + verStr)
|
||||
return verObj
|
||||
# print("path is" + ','.join(sys.path))
|
||||
Loading…
Add table
Add a link
Reference in a new issue