From f6ea93f8b47f6834e212748c61bb9c488fd02e7c Mon Sep 17 00:00:00 2001 From: Ch3LL Date: Tue, 3 Jul 2018 13:31:07 -0400 Subject: [PATCH 1/2] Add script to create release on github --- ossrelease/github_release.py | 36 ++++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 ossrelease/github_release.py diff --git a/ossrelease/github_release.py b/ossrelease/github_release.py new file mode 100644 index 0000000..1de65ae --- /dev/null +++ b/ossrelease/github_release.py @@ -0,0 +1,36 @@ +from github import Github +import argparse + +# import ossrelease modules +import conf + +def parse_args(): + ''' + Parse the CLI options. + ''' + # Define parser and set up basic options + parser = argparse.ArgumentParser(description='Send email notification for release.') + parser.add_argument('--salt-ver', help='Specify salt version to use in email') + + return parser.parse_args() + +def main(): + args = parse_args() + opts = conf.get_conf() + + repo = Github(opts['GITHUB_TOKEN']).get_repo('saltstack/salt') + + # create release + # todo: make sure the tag we are about to create a release for already exists + msg = "WARNING: The tarball generated by GitHub will not have the correct version information when using a version not ending in .0 . Please use the tarball generated by SaltStack instead. See issue #41847 for more information." + repo.create_git_release(args.salt_ver, args.salt_ver, msg) + release = repo.get_release(id=args.salt_ver) + + # todo: download pypi file + ver = args.salt_ver.split('v')[-1] + release.upload_asset('/tmp/salt-{0}.tar.gz'.format(ver)) + + # todo: add verification the release was created + +if __name__ == '__main__': + main() From 887c059a7fdbee85a6d2054c66081d09ee60065e Mon Sep 17 00:00:00 2001 From: Ch3LL Date: Tue, 3 Jul 2018 13:37:00 -0400 Subject: [PATCH 2/2] Fix github_release parse_arg descriptsions --- ossrelease/github_release.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/ossrelease/github_release.py b/ossrelease/github_release.py index 1de65ae..f5548a8 100644 --- a/ossrelease/github_release.py +++ b/ossrelease/github_release.py @@ -9,8 +9,8 @@ def parse_args(): Parse the CLI options. ''' # Define parser and set up basic options - parser = argparse.ArgumentParser(description='Send email notification for release.') - parser.add_argument('--salt-ver', help='Specify salt version to use in email') + parser = argparse.ArgumentParser(description='Create a release on github.') + parser.add_argument('--salt-ver', help='Specify salt version to create release') return parser.parse_args()