Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

GH-1995 push release branch and automate PR creation #1997

Merged
merged 1 commit into from
Mar 12, 2020
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 22 additions & 13 deletions release.sh
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,12 @@ increment_version() {
echo "$v" | perl -pe s/$rgx.*$'/${1}'`printf %0${#val}s $(($val+1))`/
}

echo ""
echo "The release script requires several external command line tools:"
echo " - git"
echo " - mvn"
echo " - hub (https://hub.github.com/)"
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we use the official command line client instead? https://cli.github.com/

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is the benefit of using hub that we don’t have to log in again?

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Btw. We need to test that hub (or whatever we end up with) works as an early step in the script. So it doesn’t crash half way through.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I wasn't aware there was another client, I thought hub is the official client. Happy to consider alternatives if they're better.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Or is the benefit of using hub that we don’t have to log in again?

No and actually that brings up a point: you need to set this tool up first before it works.

echo " - xmlllint (http://xmlsoft.org/xmllint.html)"

echo ""
echo "This script will stop if an unhandled error occurs";
Expand Down Expand Up @@ -106,11 +112,12 @@ git commit -s -a -m "release ${MVN_VERSION_RELEASE}"
git tag "${MVN_VERSION_RELEASE}"

echo "";
echo "Pushing tag to github"
echo "Pushing release branch to github"
read -n 1 -s -r -p "Press any key to continue (ctrl+c to cancel)"; printf "\n\n";

# push tag (only tag, not branch)
git push origin "${MVN_VERSION_RELEASE}"
# push release branch and tag
git push -u origin ${BRANCH}
git push "${MVN_VERSION_RELEASE}"

echo "";
echo "You need to tell jenkins to start the release process."
Expand All @@ -119,10 +126,7 @@ echo "Log in, then choose 'Build with Parameters' and type in ${MVN_VERSION_RELE
read -n 1 -s -r -p "Press any key to continue (ctrl+c to cancel)"; printf "\n\n";

# Cleanup
git checkout master
mvn clean
git branch --delete --force "${BRANCH}" &>/dev/null


# Set a new SNAPSHOT version
echo "";
Expand All @@ -143,6 +147,14 @@ git commit -s -a -m "next development iteration: ${MVN_NEXT_SNAPSHOT_VERSION}"
echo "Pushing the new version to github"
git push

echo "";
echo "About to create PR"
read -n 1 -s -r -p "Press any key to continue (ctrl+c to cancel)"; printf "\n\n";
echo "";

echo "Creating pull request to merge release branch back into master"
hub pull-request -f -m "next development iteration: ${MVN_NEXT_SNAPSHOT_VERSION}" -b origin:master

echo "";
echo "Preparing a merge-branch to merge into develop"
read -n 1 -s -r -p "Press any key to continue (ctrl+c to cancel)"; printf "\n\n";
Expand All @@ -153,7 +165,7 @@ git pull

MVN_VERSION_DEVELOP=$(xmllint --xpath "//*[local-name()='project']/*[local-name()='version']/text()" pom.xml)

git checkout master
git checkout ${BRANCH}

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Isn’t this the branch we are on already?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Yes, good point

git checkout -b "merge_master_into_develop_after_release_${MVN_VERSION_RELEASE}"
mvn versions:set -DnewVersion=${MVN_VERSION_DEVELOP}
Expand All @@ -162,12 +174,9 @@ mvn -P compliance versions:commit
git commit -s -a -m "set correct version"
git push --set-upstream origin "merge_master_into_develop_after_release_${MVN_VERSION_RELEASE}"


echo "Go to Github and create a new PR"
echo "You want to merge 'merge_master_into_develop_after_release_${MVN_VERSION_RELEASE}' into develop"
echo "You can use this link: https://github.com/eclipse/rdf4j/compare/develop...merge_master_into_develop_after_release_${MVN_VERSION_RELEASE}"
echo ""
echo "When you have created the PR you can press any key to continue. It's ok to merge the PR later, so wait for the Jenkins tests to finish."
echo "Creating pull request to merge the merge-branch into develop"
hub pull-request -f -m "sync develop branch after release ${MVN_VERSION_RELEASE}" -b origin:develop
echo "It's ok to merge this PR later, so wait for the Jenkins tests to finish."
read -n 1 -s -r -p "Press any key to continue (ctrl+c to cancel)"; printf "\n\n";

git checkout $MVN_VERSION_RELEASE
Expand Down