47 lines
1.3 KiB
Bash
Executable File
47 lines
1.3 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
|
|
set -eof pipefail
|
|
|
|
GIT_ROOT=$(git rev-parse --show-toplevel)
|
|
|
|
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"
|
|
exit 1
|
|
fi
|
|
|
|
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
|
|
echo "status-go release branches should include the v prefix!"
|
|
echo "Please create a new branch called $STATUS_GO_VERSION"
|
|
exit 1
|
|
fi
|
|
STATUS_GO_VERSION=$1
|
|
STATUS_GO_SHA256=$(nix-prefetch-url --unpack https://github.com/${STATUS_GO_OWNER}/status-go/archive/${STATUS_GO_VERSION}.zip)
|
|
|
|
|
|
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
|