-
Notifications
You must be signed in to change notification settings - Fork 448
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automate version bumps, avoid manual mistakes (#725)
- Loading branch information
1 parent
b0a06ed
commit 8adeb31
Showing
2 changed files
with
56 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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. |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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() |