Automate version bumps, avoid manual mistakes (#725)
This commit is contained in:
1 parent
b0a06edde2
commit
8adeb31d20
2 files changed
+56
No files matched your search
@@ -0,0 +1,15 @@
|
||||
Publishing New Releases
|
||||
=======================
|
||||
|
||||
First, update the version number throughout the repo and push the change:
|
||||
|
||||
./tools/makever.py --version X.Y.Z
|
||||
git commit -a -m "Update version"
|
||||
git push
|
||||
|
||||
Then tag it
|
||||
|
||||
git tag X.Y.Z
|
||||
git push origin X.Y.Z
|
||||
|
||||
Then on the GH web interface make a new release from that tag.
|
||||
Executable
+41
@@ -0,0 +1,41 @@
|
||||
#!/usr/bin/env python3
|
||||
import sys
|
||||
import struct
|
||||
import subprocess
|
||||
import re
|
||||
import os
|
||||
import os.path
|
||||
import argparse
|
||||
import time
|
||||
import shutil
|
||||
import json
|
||||
|
||||
def main():
|
||||
parser = argparse.ArgumentParser(description='Version updater')
|
||||
parser.add_argument('-v', '--version', action='store', required=True, help='Version in X.Y.Z form')
|
||||
args = parser.parse_args()
|
||||
|
||||
major, minor, sub = args.version.split(".")
|
||||
# Silly way to check for integer x.y.z
|
||||
major = int(major)
|
||||
minor = int(minor)
|
||||
sub = int(sub)
|
||||
|
||||
# library.properties
|
||||
with open("library.properties", "r") as fin:
|
||||
with open("library.properties.new", "w") as fout:
|
||||
for l in fin:
|
||||
if l.startswith("version="):
|
||||
l = "version=" + str(args.version) + "\n"
|
||||
fout.write(l);
|
||||
shutil.move("library.properties.new", "library.properties")
|
||||
|
||||
# package.json
|
||||
with open("library.json", "r") as fin:
|
||||
library = json.load(fin);
|
||||
library["version"] = str(args.version);
|
||||
with open("library.json.new", "w") as fout:
|
||||
json.dump(library, fout, indent = 4);
|
||||
shutil.move("library.json.new", "library.json")
|
||||
|
||||
main()
|
||||
Reference in new issue
Block a user