2018-05-07 09:22:14 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
|
|
|
|
set -eof pipefail
|
|
|
|
|
2019-03-25 16:35:01 +00:00
|
|
|
GIT_ROOT=$(git rev-parse --show-toplevel)
|
|
|
|
|
2018-05-08 07:58:04 +00:00
|
|
|
usage() {
|
|
|
|
printf "%s is a tool for upgrading status-go to a given version.\n" "$(basename "$0")"
|
|
|
|
printf "The given version must be uploaded to Artifactory first.\n\n"
|
|
|
|
printf "Usage:\n\n"
|
|
|
|
printf " %s version\n\n" "$(basename "$0")"
|
|
|
|
printf "Example:\n\n"
|
|
|
|
printf " %s develop-g12345678\n" "$(basename "$0")"
|
|
|
|
}
|
|
|
|
|
|
|
|
if [ "$1" = "-h" ] || [ "$1" = "--help" ]; then
|
|
|
|
usage
|
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
|
|
|
if [ $# -eq 0 ]; then
|
|
|
|
echo "Need to provide a status-go version"
|
2018-05-07 09:22:14 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
|
|
|
|
2019-05-02 11:29:10 +00:00
|
|
|
STATUS_GO_OWNER="$(cat ${GIT_ROOT}/STATUS_GO_OWNER)"
|
|
|
|
STATUS_GO_VERSION="v${1#"v"}"
|
|
|
|
if [ "$STATUS_GO_OWNER" == 'status-im' ] && [ "$STATUS_GO_VERSION" != "$1" ]; then
|
2019-03-25 16:35:01 +00:00
|
|
|
echo "status-go release branches should include the v prefix!"
|
2019-05-02 11:29:10 +00:00
|
|
|
echo "Please create a new branch called $STATUS_GO_VERSION"
|
2019-03-25 16:35:01 +00:00
|
|
|
exit 1
|
|
|
|
fi
|
2019-05-02 11:29:10 +00:00
|
|
|
STATUS_GO_VERSION=$1
|
|
|
|
STATUS_GO_SHA256=$(nix-prefetch-url --unpack https://github.com/${STATUS_GO_OWNER}/status-go/archive/${STATUS_GO_VERSION}.zip)
|
2018-05-07 09:22:14 +00:00
|
|
|
|
2019-05-02 11:29:10 +00:00
|
|
|
|
|
|
|
cat << EOF > ${GIT_ROOT}/STATUS_GO_VERSION
|
|
|
|
## DO NOT EDIT THIS FILE BY HAND. USE \`scripts/update-status-go.sh <tag>\` instead
|
|
|
|
|
|
|
|
$STATUS_GO_VERSION
|
|
|
|
EOF
|
|
|
|
cat << EOF > ${GIT_ROOT}/STATUS_GO_SHA256
|
|
|
|
## DO NOT EDIT THIS FILE BY HAND. USE \`scripts/update-status-go.sh <tag>\` instead
|
|
|
|
|
|
|
|
$STATUS_GO_SHA256
|
|
|
|
EOF
|