Skip to content

Commit

Permalink
Update release-it.json and create-homebrew-tap-pr.sh
Browse files Browse the repository at this point in the history
  • Loading branch information
pepix committed Dec 21, 2022
1 parent 16271cd commit 4efada7
Show file tree
Hide file tree
Showing 3 changed files with 32 additions and 13 deletions.
4 changes: 2 additions & 2 deletions .release-it.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
"release": true,
"assets": "brew-distribution/*.zip"
},
"buildCommand": "yarn package",
"buildCommand": "yarn package:x64; yarn package:arm64",
"hooks": {
"before:bump": "yarn declarations; yarn build:schemas",
"after:bump": "yarn package",
"after:bump": "yarn package:x64; yarn package:arm64",
"after:release": "VERSION=${version} scripts/create-homebrew-tap-pr.sh"
}
}
4 changes: 2 additions & 2 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,8 @@ Following [this commit](https://github.com/danger/danger-js/commit/a26ac3b3bd4f0
- Modify `changelog.md`, adding a new `### 0.21.0` heading under the `### Main` heading at the top of the file.
- Commit both changes with the commit message **Version bump**.
- Tag this commit - `git tag 0.21.0`.
- Push the commit and tag to master - `git push origin main --follow-tags`. Travis CI will build the tagged commit and
publish that tagged version to NPM.
- Push the commit and tag to master - `git push origin main --follow-tags`. GitHub Actions will build the tagged commit
and publish that tagged version to NPM.

:ship:

Expand Down
37 changes: 28 additions & 9 deletions scripts/create-homebrew-tap-pr.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,22 @@

[ -z ${VERSION+x} ] && { echo "VERSION is missing"; exit 1; }

FILE=brew-distribution/danger-macos.zip
FILE_X64=brew-distribution/danger-macos-x64.zip
FILE_ARM64=brew-distribution/danger-macos-arm64.zip

if [ ! -f ${FILE} ]; then
echo ${FILE} not found!
if [ ! -f ${FILE_X64} ]; then
echo ${FILE_X64} not found!
exit 1
fi
if [ ! -f ${FILE_ARM64} ]; then
echo ${FILE_ARM64} not found!
exit 1
fi

SHA=$(shasum -a 256 ${FILE} | cut -f 1 -d " ")
echo "$SHA"
SHA_X64=$(shasum -a 256 ${FILE_X64} | cut -f 1 -d " ")
echo "SHA_X64=$SHA_X64"
SHA_ARM64=$(shasum -a 256 ${FILE_ARM64} | cut -f 1 -d " ")
echo "SHA_ARM64=$SHA_ARM64"

# Clone tap repo
HOMEBREW_TAP_TMPDIR=$(mktemp -d)
Expand All @@ -23,11 +30,23 @@ cd "$HOMEBREW_TAP_TMPDIR" || exit 1
# Write formula
echo "class DangerJs < Formula" > danger-js.rb
echo " homepage \"https://github.com/danger/danger-js\"" >> danger-js.rb
echo " url \"https://github.com/danger/danger-js/releases/download/${VERSION}/danger-macos.zip\"" >> danger-js.rb
echo " sha256 \"${SHA}\"" >> danger-js.rb
echo >> danger-js.rb
echo " def install" >> danger-js.rb
echo " bin.install \"danger\"" >> danger-js.rb
echo " if Hardware::CPU.intel?" >> danger-js.rb
echo " url \"https://github.com/danger/danger-js/releases/download/${VERSION}/danger-macos-x64.zip\"" >> danger-js.rb
echo " sha256 \"${SHA_X64}\"" >> danger-js.rb
echo >> danger-js.rb
echo " def install" >> danger-js.rb
echo " bin.install \"danger-x64\" => \"danger\"" >> danger-js.rb
echo " end" >> danger-js.rb
echo " end" >> danger-js.rb
echo >> danger-js.rb
echo " if Hardware::CPU.arm?" >> danger-js.rb
echo " url \"https://github.com/danger/danger-js/releases/download/${VERSION}/danger-macos-arm64.zip\"" >> danger-js.rb
echo " sha256 \"${SHA_ARM64}\"" >> danger-js.rb
echo >> danger-js.rb
echo " def install" >> danger-js.rb
echo " bin.install \"danger-arm64\" => \"danger\"" >> danger-js.rb
echo " end" >> danger-js.rb
echo " end" >> danger-js.rb
echo "end" >> danger-js.rb

Expand Down

0 comments on commit 4efada7

Please sign in to comment.