Automatically update Homebrew package when new versions are released (#3083)

Closes #2841
This commit is contained in:
Daniel Lo Nigro
2017-04-13 08:19:09 -07:00
committed by GitHub
parent fecbc0abb0
commit a3226f4a53
2 changed files with 45 additions and 0 deletions

View File

@@ -0,0 +1,26 @@
#!/bin/bash
# Pushes the latest Yarn version to Homebrew
set -ex
version=`curl --fail https://yarnpkg.com/latest-version`
# Ensure Linuxbrew is on the PATH
PATH=$PATH:$HOME/.linuxbrew/bin/
# Ensure homebrew-core is pointing to Homebrew rather than Linuxbrew
pushd ~/.linuxbrew/Library/Taps/homebrew/homebrew-core
#git remote set-url origin https://github.com/Daniel15/homebrew-core # for testing
git remote set-url origin https://github.com/homebrew/homebrew-core
# Remove any existing branch (eg. if the previous attempt failed)
git branch -D yarn-$version || true
popd
# Grab latest Yarn release so we can hash it
url=https://yarnpkg.com/downloads/$version/yarn-v$version.tar.gz
tempfile=`mktemp -t 'yarn-release-XXXXXXXX.tar.gz'`
curl --fail -L -o $tempfile $url
hash=`sha256sum $tempfile | head -c 64`
# Update the formula!
# "BROWSER=/bin/true" is a hack around https://github.com/Homebrew/brew/issues/2468
BROWSER=/bin/true brew bump-formula-pr --strict yarn --url=$url --sha256=$hash --message="This PR was automatically created via a script. Contact @Daniel15 with any questions."