2019-09-20 21:44:51 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
|
|
|
export SCRIPT_DIR="$(cd "$(dirname "$0")/.." && pwd)"
|
2019-09-21 20:43:17 +00:00
|
|
|
source "${SCRIPT_DIR}/src/main.sh"
|
2019-09-21 20:14:52 +00:00
|
|
|
|
|
|
|
sha256() {
|
2019-09-23 20:46:16 +00:00
|
|
|
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
|
2019-09-21 20:14:52 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
header() {
|
2019-09-23 20:46:16 +00:00
|
|
|
echo "$*"
|
|
|
|
echo
|
2019-09-21 20:14:52 +00:00
|
|
|
}
|
|
|
|
|
2019-09-21 20:43:17 +00:00
|
|
|
cd "$SCRIPT_DIR"
|
|
|
|
|
2019-09-21 20:14:52 +00:00
|
|
|
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"
|
|
|
|
|
2019-09-21 20:14:52 +00:00
|
|
|
header "Attempting to release version ${tag}..."
|
|
|
|
read -p "Press enter to continue"
|
2019-09-20 21:44:51 +00:00
|
|
|
|
2019-09-21 20:14:52 +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
|
|
|
|
2019-09-21 20:14:52 +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
|
|
|
|
2019-09-21 20:14:52 +00:00
|
|
|
header "rm formula"
|
2019-09-25 11:16:30 +00:00
|
|
|
rm "$formula" 2>/dev/null || true
|
2019-09-20 21:44:51 +00:00
|
|
|
|
2019-09-21 20:14:52 +00:00
|
|
|
header "tar sha256"
|
|
|
|
sha="$(curl -sL "$tar" | sha256 | awk '{print $1}')"
|
2019-09-20 21:44:51 +00:00
|
|
|
|
2019-09-21 20:14:52 +00:00
|
|
|
header "output"
|
|
|
|
echo " url \"${tar}\""
|
|
|
|
echo " sha256 \"${sha}\""
|