mirror of
https://github.com/kremalicious/metamask-extension.git
synced 2024-11-25 20:02:58 +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.
52 lines
1.3 KiB
Bash
Executable File
52 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -x
|
|
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
|
|
|
|
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
|
|
}
|
|
|
|
current_commit_msg=$(git show -s --format='%s' HEAD)
|
|
|
|
if [[ $current_commit_msg =~ Version[-[:space:]](v[[:digit:]]+.[[:digit:]]+.[[:digit:]]+) ]]
|
|
then
|
|
tag="${BASH_REMATCH[1]}"
|
|
|
|
install_github_cli
|
|
|
|
printf '%s\n' 'Creating GitHub Release'
|
|
release_body="$(awk -v version="${tag##v}" -f .circleci/scripts/show-changelog.awk CHANGELOG.md)"
|
|
pushd builds
|
|
hub release create \
|
|
--attach metamask-chrome-*.zip \
|
|
--attach metamask-firefox-*.zip \
|
|
--message "Version ${tag##v}" \
|
|
--message "$release_body" \
|
|
--commitish "$CIRCLE_SHA1" \
|
|
"$tag"
|
|
popd
|
|
else
|
|
printf '%s\n' 'Version not found in commit message; skipping GitHub Release'
|
|
exit 0
|
|
fi
|