Skip to content
Snippets Groups Projects
Commit 565b6759 authored by Bill DeRusha's avatar Bill DeRusha
Browse files

Add automatic release branch cutting to release script

parent 0d2dc431
No related merge requests found
......@@ -17,6 +17,7 @@ try:
from path import Path as path
from git import Repo, Commit
from git.refs.symbolic import SymbolicReference
from git.exc import GitCommandError
from dateutil.parser import parse as parse_datestring
import requests
import yaml
......@@ -99,6 +100,9 @@ def make_parser():
parser.add_argument(
'--table', '-t', action="store_true", default=False,
help="only print table")
parser.add_argument(
'--cut-branch', '-b', action="store_true", default=False,
help="automatically cut the release branch")
return parser
......@@ -522,6 +526,26 @@ def generate_email(start_ref, end_ref, release_date=None):
return textwrap.dedent(email).strip()
def cut_release_branch(release_date=None):
if release_date is None:
release_date = default_release_date()
release_branch_name = "rc/{date}".format(date=release_date)
print("Cutting release branch '{name}'...".format(name=release_branch_name))
try:
print(git.checkout('master'))
print(git.pull())
print(git.checkout('HEAD', b=release_branch_name))
print(git.push())
except GitCommandError as exception:
print(exception)
return None
return release_branch_name
def main():
parser = make_parser()
args = parser.parse_args()
......@@ -560,6 +584,17 @@ def main():
print("\n")
print(generate_commit_table(args.previous, args.current))
if args.cut_branch:
branch_name = cut_release_branch(args.date)
if branch_name:
print(
"OPEN THE PULL REQUEST: https://github.com/edx/edx-platform/compare/release...{name}".format(
name=branch_name
)
)
else:
print("Skipping branch cut")
if __name__ == "__main__":
main()
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment