diff --git a/build.sh b/build.sh index 4ff410d67..06c90dfcf 100755 --- a/build.sh +++ b/build.sh @@ -24,6 +24,7 @@ if [ -n "${TEAMCITY_VERSION:-}" ]; then source "$VENV/bin/activate" set -u pip install -U pip setuptools pyinstaller + python set-version.py fi npm install @@ -75,6 +76,6 @@ if [ -n "${TEAMCITY_VERSION:-}" ]; then # it to reliably work and it also seemed difficult to configure. Not proud of # this, but it seemed better to write my own. pip install PyGithub uritemplate - python release-on-tag.py --force + python release-on-tag.py deactivate fi diff --git a/set-version.py b/set-version.py new file mode 100644 index 000000000..720e8d7d3 --- /dev/null +++ b/set-version.py @@ -0,0 +1,20 @@ +"""Set the package version to the output of `git describe`""" + +import json +import os.path +import subprocess +import sys + + +def main(): + version = subprocess.check_output(['git', 'describe']).strip() + package_file = os.path.join('app', 'package.json') + with open(package_file) as fp: + package_data = json.load(fp) + package_data['version'] = version + with open(package_file, 'w') as fp: + json.dump(package_data, fp, indent=2, separators=(',', ': ')) + + +if __name__ == '__main__': + sys.exit(main())