forked from yarnpkg/yarn
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Automatically update Homebrew package when new versions are released
Closes yarnpkg#2841
- Loading branch information
Showing
2 changed files
with
45 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -62,3 +62,22 @@ job('yarn-chocolatey') { | |
mailer '[email protected]' | ||
} | ||
} | ||
|
||
job('yarn-homebrew') { | ||
description 'Ensures the Homebrew package for Yarn is up-to-date' | ||
label 'linuxbrew' | ||
scm { | ||
github 'yarnpkg/yarn', 'master' | ||
} | ||
triggers { | ||
yarnStableVersionChange delegate | ||
} | ||
steps { | ||
shell './scripts/update-homebrew.sh' | ||
} | ||
publishers { | ||
gitHubIssueNotifier { | ||
} | ||
mailer '[email protected]' | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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." |