use git describe as version

This commit is contained in:
jobevers 2017-02-09 20:09:31 -06:00
parent 780c742407
commit 7ea447ef35
2 changed files with 22 additions and 1 deletions

View file

@ -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

20
set-version.py Normal file
View file

@ -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())