Chrome Extension auto-increment version number and zip extension on commit via git hooks
#!/usr/bin/env ruby | |
require 'json' | |
filename = './manifest.json' | |
text = File.read(filename) | |
json = JSON.parse(text) | |
oldVersion = json['version'] | |
version = json['version'].split(".") | |
if (version[2] == "9") | |
version[2] = "0" | |
version[1] = (version[1].to_i + 1).to_s | |
else | |
version[-1] = (version[-1].to_i + 1).to_s | |
end | |
vstring = version[0] + "." + version[1] + "." + version[2] | |
json['version'] = vstring | |
File.open(filename, "w") do |f| | |
f.write(JSON.pretty_generate(json)) | |
end | |
Dir.chdir('..') | |
`zip -r "TrademarkSearchHelper/Builds/TrademarkSearchHelper-#{oldVersion}.zip" "TrademarkSearchHelper" -x "*.zip*"` |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment