status-react/scripts/update-status-go.sh

44 lines
1.3 KiB
Bash
Raw Normal View History

2018-05-07 09:22:14 +00:00
#!/usr/bin/env bash
set -eof pipefail
GIT_ROOT=$(cd "${BASH_SOURCE%/*}" && 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"
2018-05-07 09:22:14 +00:00
exit 1
fi
repoUrl="https://github.com/${STATUS_GO_OWNER:=status-im}/status-go"
STATUS_GO_VERSION=$1
STATUS_GO_SHA256=$(nix-prefetch-url --unpack ${repoUrl}/archive/${STATUS_GO_VERSION}.zip)
STATUS_GO_COMMIT_SHA1=$(git ls-remote ${repoUrl} U ${STATUS_GO_VERSION} | cut -f1)
cat << EOF > ${GIT_ROOT}/status-go-version.json
{
"_comment": "DO NOT EDIT THIS FILE BY HAND. USE 'scripts/update-status-go.sh <tag>' instead",
"owner": "${STATUS_GO_OWNER}",
"version": "${STATUS_GO_VERSION}",
"commit-sha1": "${STATUS_GO_COMMIT_SHA1}",
"src-sha256": "${STATUS_GO_SHA256}"
}
EOF
echo "SHA-1 for ${STATUS_GO_VERSION} is ${STATUS_GO_COMMIT_SHA1}.
SHA-256 for source archive is ${STATUS_GO_SHA256}
Owner is ${STATUS_GO_OWNER}"