Skip to content

Commit

Permalink
Target master with release PR
Browse files Browse the repository at this point in the history
`master` is now targetted by the release PR instead of `develop`, as
the release has to be created from the master branch.

The update to `develop` is handled after the release by a PR from
`master` to `develop`, which is created automatically after the
release.
  • Loading branch information
Gudahtt committed Sep 10, 2019
1 parent a3fcb76 commit c8b0c37
Show file tree
Hide file tree
Showing 3 changed files with 57 additions and 1 deletion.
3 changes: 3 additions & 0 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
Expand Up @@ -240,6 +240,9 @@ jobs:
name: Create GitHub release
command: |
.circleci/scripts/release-create-gh-release
- run:
name: Create GitHub Pull Request to sync master with develop
command: .circleci/scripts/release-create-master-pr
# - run:
# name: github gh-pages docs publish
# command: >
Expand Down
53 changes: 53 additions & 0 deletions .circleci/scripts/release-create-master-pr
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
#!/usr/bin/env bash

set -e
set -u
set -o pipefail

if [[ "${CI:-}" != 'true' ]]
then
printf '%s\n' 'CI environment variable must be set to true'
exit 1
fi

if [[ "${CIRCLECI:-}" != 'true' ]]
then
printf '%s\n' 'CIRCLECI environment variable must be set to true'
exit 1
fi

if [[ -z "${GITHUB_TOKEN:-}" ]]
then
printf '%s\n' 'GITHUB_TOKEN environment variable must be set'
exit 1
fi

function install_github_cli ()
{
printf '%s\n' 'Installing hub CLI'
pushd "$(mktemp -d)"
curl -sSL 'https://github.com/github/hub/releases/download/v2.11.2/hub-linux-amd64-2.11.2.tgz' | tar xz
PATH="$PATH:$PWD/hub-linux-amd64-2.11.2/bin"
popd
}

base_branch='develop'

if [[ -n "${CI_PULL_REQUEST:-}" ]]
then
printf '%s\n' 'CI_PULL_REQUEST is set, pull request already exists for this build'
exit 0
fi

install_github_cli

printf '%s\n' "Creating a Pull Request to sync 'master' with 'develop'"

if ! hub pull-request \
--reviewer '@MetaMask/extension-release-team' \
--message "Master => develop" --message 'Merge latest release back into develop' \
--base "$CIRCLE_PROJECT_USERNAME:$base_branch" \
--head "$CIRCLE_PROJECT_USERNAME:$CIRCLE_BRANCH";
then
printf '%s\n' 'Pull Request already exists'
fi
2 changes: 1 addition & 1 deletion .circleci/scripts/release-create-release-pr
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function install_github_cli ()
}

version="${CIRCLE_BRANCH/Version-v/}"
base_branch='develop'
base_branch='master'

if [[ -n "${CI_PULL_REQUEST:-}" ]]
then
Expand Down

0 comments on commit c8b0c37

Please sign in to comment.