navi/scripts/release

52 lines
1 KiB
Text
Raw Normal View History

2019-09-20 21:44:51 +00:00
#!/usr/bin/env bash
set -euo pipefail
export SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
source "${SCRIPT_DIR}/src/main.sh"
sha256() {
if command_exists sha256sum; then
sha256sum
elif command_exists shasum; then
shasum -a 256
elif command_exists openssl; then
openssl dgst -sha256
else
echoerr "Unable to calculate sha256!"
exit 43
fi
}
header() {
echo "$*"
echo
}
cd "$SCRIPT_DIR"
header "git pull"
2019-09-21 20:15:16 +00:00
git pull
2019-09-20 21:48:25 +00:00
version="$(grep VERSION "${SCRIPT_DIR}/navi" | grep -Eo '[0-9\.]+')"
tag="v${version}"
2019-09-20 21:49:47 +00:00
tar="https://github.com/denisidoro/navi/archive/${tag}.tar.gz"
2019-09-20 21:44:51 +00:00
formula="/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core/Formula/navi.rb"
header "Attempting to release version ${tag}..."
read -p "Press enter to continue"
2019-09-20 21:44:51 +00:00
header "git tag"
2019-09-21 20:15:16 +00:00
git tag -a "$tag" -m "$tag"
2019-09-20 21:44:51 +00:00
header "git push"
2019-09-21 20:15:16 +00:00
git push --follow-tags
2019-09-20 21:44:51 +00:00
header "rm formula"
2019-09-20 21:44:51 +00:00
rm "$formula" || true
header "tar sha256"
sha="$(curl -sL "$tar" | sha256 | awk '{print $1}')"
2019-09-20 21:44:51 +00:00
header "output"
echo " url \"${tar}\""
echo " sha256 \"${sha}\""