mirror of
https://github.com/zhigang1992/yarn.git
synced 2026-04-30 02:05:06 +08:00
Automatically update Homebrew package when new versions are released (#3083)
Closes #2841
This commit is contained in:
26
scripts/update-homebrew.sh
Normal file
26
scripts/update-homebrew.sh
Normal 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."
|
||||
Reference in New Issue
Block a user