This repository has been archived by the owner on Mar 24, 2022. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 9
[WIP] Add script to create release on github #19
Open
Ch3LL
wants to merge
2
commits into
vmware-archive:master
Choose a base branch
from
Ch3LL:create_release
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
Changes from all commits
Commits
Show all changes
2 commits
Select commit
Hold shift + click to select a range
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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,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='Create a release on github.') | ||
parser.add_argument('--salt-ver', help='Specify salt version to create release') | ||
|
||
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 | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I know this is a first pass, but I'd like to see this kind of validation happen before this script is merged in. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. k i'll add the [WIP] for now until i can get to this again. might be a while. |
||
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() |
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Is this from
PyGithub
? Let's document that as a requirement/dependency somewhere.That import should probably be moved to a separate
# Import 3rd party libs
line too, just to keep things organized. I know that is picky, but might as well start off that way :)