2019-09-20 21:44:51 +00:00
|
|
|
#!/usr/bin/env bash
|
|
|
|
set -euo pipefail
|
|
|
|
|
2019-10-11 17:33:16 +00:00
|
|
|
export NAVI_HOME="$(cd "$(dirname "$0")/.." && pwd)"
|
|
|
|
source "${NAVI_HOME}/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-10-11 17:33:16 +00:00
|
|
|
cd "$NAVI_HOME"
|
2019-09-21 20:43:17 +00:00
|
|
|
|
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
|
|
|
|
2019-10-11 17:33:16 +00:00
|
|
|
version="$(grep VERSION "${NAVI_HOME}/navi" | grep -Eo '[0-9\.]+')"
|
2019-09-20 21:48:25 +00:00
|
|
|
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}\""
|