patch.py now includes the jar hash
This commit is contained in:
parent
70716ed577
commit
2e4acab09a
38
patch.py
38
patch.py
@ -1,17 +1,38 @@
|
|||||||
import json
|
import json
|
||||||
import subprocess
|
import subprocess
|
||||||
|
from hashlib import sha256
|
||||||
|
|
||||||
# This script will:
|
# This script will:
|
||||||
# - read current version
|
# - read current version
|
||||||
# - increment patch version
|
# - increment patch version
|
||||||
# - update version in a few places
|
# - update version in a few places
|
||||||
# - insert new line in ripme.json with message
|
# - insert new line in ripme.json with message
|
||||||
|
# - build ripme
|
||||||
|
# - add the hash of the lastest binary to ripme.json
|
||||||
|
|
||||||
message = input('message: ')
|
message = input('message: ')
|
||||||
|
|
||||||
|
def get_ripme_json():
|
||||||
with open('ripme.json') as dataFile:
|
with open('ripme.json') as dataFile:
|
||||||
ripmeJson = json.load(dataFile)
|
ripmeJson = json.load(dataFile)
|
||||||
currentVersion = ripmeJson["latestVersion"]
|
return ripmeJson
|
||||||
|
|
||||||
|
def update_hash(current_hash):
|
||||||
|
ripmeJson = get_ripme_json()
|
||||||
|
with open('ripme.json', 'w') as dataFile:
|
||||||
|
ripmeJson["currentHash"] = current_hash
|
||||||
|
print(ripmeJson["currentHash"])
|
||||||
|
json.dump(ripmeJson, dataFile, indent=4)
|
||||||
|
|
||||||
|
def update_change_list(message):
|
||||||
|
ripmeJson = get_ripme_json()
|
||||||
|
with open('ripme.json', 'w') as dataFile:
|
||||||
|
ripmeJson["changeList"] = ripmeJson["changeList"].insert(0, message)
|
||||||
|
print(ripmeJson["currentHash"])
|
||||||
|
json.dump(ripmeJson, dataFile, indent=4)
|
||||||
|
|
||||||
|
|
||||||
|
currentVersion = get_ripme_json()["latestVersion"]
|
||||||
|
|
||||||
print('Current version ' + currentVersion)
|
print('Current version ' + currentVersion)
|
||||||
|
|
||||||
@ -51,6 +72,15 @@ dataFile = open("ripme.json", "w")
|
|||||||
dataFile.write(outputContent)
|
dataFile.write(outputContent)
|
||||||
dataFile.close()
|
dataFile.close()
|
||||||
|
|
||||||
subprocess.call(['git', 'add', '-u'])
|
# subprocess.call(['git', 'add', '-u'])
|
||||||
subprocess.call(['git', 'commit', '-m', commitMessage])
|
# subprocess.call(['git', 'commit', '-m', commitMessage])
|
||||||
subprocess.call(['git', 'tag', nextVersion])
|
# subprocess.call(['git', 'tag', nextVersion])
|
||||||
|
print("Building ripme")
|
||||||
|
subprocess.call(["mvn", "clean", "compile", "assembly:single"])
|
||||||
|
print("Hashing .jar file")
|
||||||
|
openedFile = open("./target/ripme-{}-jar-with-dependencies.jar".format(nextVersion), "rb")
|
||||||
|
readFile = openedFile.read()
|
||||||
|
file_hash = sha256(readFile).hexdigest()
|
||||||
|
print("Hash is: {}".format(file_hash))
|
||||||
|
print("Updating hash")
|
||||||
|
update_hash(file_hash)
|
Loading…
Reference in New Issue
Block a user