mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-12-23 09:52:26 +01:00
c9fffafd9a
* Publish GitHub release from master branch This ensures that changes made on `develop` since branching for the release are not included. It also ensures that the final release sourcemaps line-up correctly (they were always build on master)`. * Consolidate publish jobs The jobs `job-publish-release` and `create_github_release` both handle different parts of publishing a release. They have been consolidated into a single `job-publish-release` job. * Update release script to expect a merge commit The release script was originally written to be run on `develop`, so it expected the current commit to be a result of `Squash & Merge`. Now that it's run on `master`, it will generally be run against a merge commit. The version is now extracted from the commit message using a regular expression that should work on all version of Bash v3+, and should be tolerant of both merge commits and `Squash & Merge` commits. * Target `master` with release PR `master` is now targeted 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.
54 lines
1.2 KiB
Bash
Executable File
54 lines
1.2 KiB
Bash
Executable File
#!/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
|