Can now publish new release automatically

This commit is contained in:
cyian-1756 2018-06-07 06:07:03 -04:00
parent 086e52cd65
commit 3084d04893

View File

@ -6,8 +6,6 @@ import sys
from hashlib import sha256 from hashlib import sha256
from github import Github from github import Github
import json import json
from datetime import timezone
import datetime
import argparse import argparse
parser = argparse.ArgumentParser(description="Make a new ripme release on github") parser = argparse.ArgumentParser(description="Make a new ripme release on github")
@ -38,8 +36,11 @@ ripmeJson = json.loads(open("ripme.json").read())
fileToUploadPath = args.file fileToUploadPath = args.file
InNoninteractiveMode = args.non_interactive InNoninteractiveMode = args.non_interactive
commitMessage = ripmeJson.get("changeList")[0] commitMessage = ripmeJson.get("changeList")[0]
releaseVersion = ripmeJson.get("latestVersion")
debug = args.debug debug = args.debug
accessToken = args.token accessToken = args.token
repoOwner = "ripmeapp"
repoName = "ripme"
if not os.path.isfile(fileToUploadPath): if not os.path.isfile(fileToUploadPath):
print("[!] Error: {} does not exist".format(fileToUploadPath)) print("[!] Error: {} does not exist".format(fileToUploadPath))
@ -71,9 +72,17 @@ if expectedHash != actualHash:
# Ask the user to review the information before we precede # Ask the user to review the information before we precede
# This only runs in we're in interactive mode # This only runs in we're in interactive mode
if not InNoninteractiveMode: if not InNoninteractiveMode:
print("File path: {}\n".format(fileToUploadPath)) print("File path: {}".format(fileToUploadPath))
print("Release title: {}".format(commitMessage)) print("Release title: {}".format(commitMessage))
print("Repo: {}/{}".format(repoOwner, repoName))
input("\nPlease review the information above and ensure it is correct and then press enter") input("\nPlease review the information above and ensure it is correct and then press enter")
print("Accessing github using token") print("Accessing github using token")
g = Github(accessToken) g = Github(accessToken)
print("Creating release")
release = g.get_user(repoOwner).get_repo(repoName).create_git_release(releaseVersion, commitMessage, "")
print("Uploading file")
release.upload_asset(fileToUploadPath, "ripme.jar")