From d8b629f41406be3dff66769979875b8364a940b6 Mon Sep 17 00:00:00 2001 From: Raymond Hill Date: Mon, 5 Mar 2018 13:14:10 -0500 Subject: [PATCH] add commit/push to sign/publish script --- dist/firefox/publish-signed-beta.py | 17 ++++++++++++++--- 1 file changed, 14 insertions(+), 3 deletions(-) diff --git a/dist/firefox/publish-signed-beta.py b/dist/firefox/publish-signed-beta.py index 6b53c639f..fe7d7de39 100755 --- a/dist/firefox/publish-signed-beta.py +++ b/dist/firefox/publish-signed-beta.py @@ -256,8 +256,19 @@ with open(updates_json_filepath) as f: f.close() updates_json = template_json.substitute(version=version) with open(updates_json_filepath, 'w') as f: - f.write(updates_json) - f.close() - # TODO: automatically git add/commit? + f.write(updates_json) + f.close() + # 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.')