From 60337027dc32198c71d2c05757dde5071eb5c2d5 Mon Sep 17 00:00:00 2001 From: Dan Sosedoff Date: Mon, 25 Feb 2019 12:31:46 -0600 Subject: [PATCH] Add script to bump Homebrew formula version --- script/update_homebrew.sh | 24 ++++++++++++++++++++++++ 1 file changed, 24 insertions(+) create mode 100755 script/update_homebrew.sh diff --git a/script/update_homebrew.sh b/script/update_homebrew.sh new file mode 100755 index 0000000..0280f55 --- /dev/null +++ b/script/update_homebrew.sh @@ -0,0 +1,24 @@ +#!/bin/bash + +RELEASE_FILE="./tmp/release.json" +HOMEBREW_ROOT="/usr/local/Homebrew/Library/Taps/homebrew/homebrew-core" +export HOMEBREW_GITHUB_API_TOKEN=$(awk '/api.github.com/{getline;getline;print $2}' ~/.netrc) + +# Setup directory +mkdir -p ./tmp +rm -rf ./tmp/* + +# Fetch the latest published version +curl -s https://api.github.com/repos/sosedoff/pgweb/releases/latest > $RELEASE_FILE +VERSION="$(jq -r .tag_name < $RELEASE_FILE)" +URL="https://github.com/sosedoff/pgweb/archive/$VERSION.tar.gz" +URL_SHA256=$(wget -qO- $URL | shasum -a 256 | cut -d ' ' -f 1) + +# Reset any changes +git -C $HOMEBREW_ROOT reset --hard + +# Update formula +brew bump-formula-pr \ + --url=$URL \ + --sha256=$URL_SHA256 \ + pgweb