You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
52 lines
1.3 KiB
52 lines
1.3 KiB
5 years ago
|
#!/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)
|
||
|
|
||
5 years ago
|
if [[ $current_commit_msg =~ Version[-[:space:]](v[[:digit:]]+.[[:digit:]]+.[[:digit:]]+) ]]
|
||
5 years ago
|
then
|
||
5 years ago
|
tag="${BASH_REMATCH[1]}"
|
||
|
|
||
5 years ago
|
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 \
|
||
5 years ago
|
--message "Version ${tag##v}" \
|
||
5 years ago
|
--message "$release_body" \
|
||
|
--commitish "$CIRCLE_SHA1" \
|
||
|
"$tag"
|
||
|
popd
|
||
|
else
|
||
5 years ago
|
printf '%s\n' 'Version not found in commit message; skipping GitHub Release'
|
||
5 years ago
|
exit 0
|
||
|
fi
|