add commit/push to sign/publish script

This commit is contained in:
Raymond Hill 2018-03-05 13:14:10 -05:00
parent 9b2a490887
commit d8b629f414
No known key found for this signature in database
GPG Key ID: 25E1490B761470C2
1 changed files with 14 additions and 3 deletions

View File

@ -258,6 +258,17 @@ with open(updates_json_filepath) as f:
with open(updates_json_filepath, 'w') as f:
f.write(updates_json)
f.close()
# TODO: automatically git add/commit?
# Automatically git add/commit if needed.
# - Stage the changed file
r = subprocess.run(['git', 'status', '-s', updates_json_filepath], stdout=subprocess.PIPE)
rout = bytes.decode(r.stdout).strip()
if len(rout) >= 2 and rout[1] == 'M':
subprocess.run(['git', 'add', updates_json_filepath])
# - Commit the staged file
r = subprocess.run(['git', 'status', '-s', updates_json_filepath], stdout=subprocess.PIPE)
rout = bytes.decode(r.stdout).strip()
if len(rout) >= 2 and rout[0] == 'M':
subprocess.run(['git', 'commit', '-m', 'make Firefox dev build auto-update', updates_json_filepath])
subprocess.run(['git', 'push', 'origin', 'master'])
print('All done.')