Onionr/install/create_release.py

53 lines
1.7 KiB
Python
Raw Permalink Normal View History

2019-03-29 04:01:59 +00:00
import os
version = ''
2019-03-29 04:16:23 +00:00
contents = ''
2019-03-29 04:01:59 +00:00
with open('../onionr/onionr.py', 'r') as f:
2019-03-29 04:16:23 +00:00
contents = f.read()
version = contents.split("ONIONR_VERSION = '")[1].split("'")[0]
2019-03-29 04:01:59 +00:00
print('Current Onionr release version is %s (MAJOR.MINOR.VERSION)\n' % version)
new_version = input('Enter new version: ')
try:
int(new_version.replace('.', ''))
except:
print('Invalid version number, try again.')
exit(1337)
confirm = input('Please confirm the version change from %s to %s (y/N): ' % (version, new_version))
print('\n------\n')
if confirm.lower().startswith('y'):
print('- Updating version in onionr.py')
2019-03-29 04:05:15 +00:00
with open('../onionr/onionr.py', 'w+') as f:
2019-03-29 04:16:23 +00:00
f.write(contents.replace("ONIONR_VERSION = '%s'" % version, "ONIONR_VERSION = '%s'" % new_version))
2019-03-29 04:01:59 +00:00
print('- Updating version in PKGBUILD')
2019-03-29 04:05:15 +00:00
with open('../onionr/PKGBUILD', 'w+') as f:
2019-03-29 04:01:59 +00:00
f.write(f.read().replace("pkgver=%s" % version, "pkgver=%s" % new_version))
print('- Committing changes')
os.system('cd ..; git add onionr/onionr.py; git commit -m "Increment Onionr version to %s"' % new_version)
print('- Adding tag')
os.system('cd ..; git tag %s' % new_version)
print('- Pushing changes')
2019-03-29 04:16:23 +00:00
# os.system('cd ..; git push origin --tags')
2019-03-29 04:01:59 +00:00
print('\n------\n\nAll done. Create a merge request into master at this link:\n\nhttps://gitlab.com/beardog/Onionr/merge_requests/new?merge_request%5Bsource_project_id%5D=5020889&merge_request%5Btarget_branch%5D=master&merge_request%5Btarget_project_id%5D=5020889')
2019-03-29 06:24:41 +00:00
print('\nNOTE: The default configuration file was not changed. Please make sure it is not in dev mode, and that log.verbosity is "error".')
2019-03-29 04:01:59 +00:00
else:
print('Change cancelled. No action has been taken.')