-
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.
- Loading branch information
1 parent
6e219d7
commit 2c19bd8
Showing
2 changed files
with
68 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 |
---|---|---|
|
@@ -239,11 +239,54 @@ jobs: | |
tags: ${{ steps.meta.outputs.tags }} | ||
labels: ${{ steps.meta.outputs.labels }} | ||
|
||
release-homebrew: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- build-linux | ||
steps: | ||
- name: Checkout | ||
uses: actions/checkout@v3 | ||
|
||
- name: Checkout Homebrew repo | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: mittwald/homebrew-cli | ||
path: homebrew | ||
token: ${{ secrets.MACHINE_USER_TOKEN }} | ||
|
||
- name: Download artifacts | ||
uses: actions/download-artifact@v3 | ||
|
||
- name: Generate Homebrew formula | ||
run: | | ||
sed \ | ||
's/__VERSION_/${GITHUB_REF_NAME#v}/' \ | ||
's/__VERSIONHASH__/$(git rev-parse --short ${{ github.sha }})/' \ | ||
's/__SHA_X64/$(sha256sum pkg-tarballs/mw-*-x64.tar.xz | awk '{print $1}')/' \ | ||
's/__SHA_ARM64/$(sha256sum pkg-tarballs/mw-*-arm64.tar.xz | awk '{print $1}')/' < scripts/release/homebrew.rb > homebrew/mw.rb | ||
- name: Generate .netrc | ||
run: | | ||
echo -e "machine github.com\nlogin ${MACHINE_USER_NAME}\npassword ${MACHINE_USER_TOKEN}" > ~/.netrc | ||
env: | ||
MACHINE_USER_NAME: ${{ secrets.MACHINE_USER_NAME }} | ||
MACHINE_USER_TOKEN: ${{ secrets.MACHINE_USER_TOKEN }} | ||
|
||
- name: Commit and push | ||
run: | | ||
cd homebrew | ||
git config --global user.email "[email protected]" | ||
git config --global user.name "mittwald machine" | ||
git add mw.rb | ||
git commit -m "Release ${GITHUB_REF_NAME}" | ||
git push | ||
cleanup-artifacts: | ||
runs-on: ubuntu-latest | ||
needs: | ||
- release-github | ||
- release-docker | ||
- release-homebrew | ||
steps: | ||
- uses: geekyeggo/delete-artifact@v1 | ||
with: | ||
|
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,25 @@ | ||
class Mw < Formula | ||
desc "The mittwald command-line tool" | ||
homepage "https://github.com/mittwald/cli" | ||
url "https://mittwald-cli.s3.eu-central-1.amazonaws.com/versions/__VERSION__/__VERSIONHASH__/mw-v__VERSION__-__VERSIONHASH__-darwin-x64.tar.xz" | ||
sha256 "__SHA_X64__" | ||
version "__VERSION__" | ||
version_scheme 1 | ||
|
||
on_macos do | ||
if Hardware::CPU.arm? | ||
url "https://mittwald-cli.s3.eu-central-1.amazonaws.com/versions/__VERSION__/__VERSIONHASH__/mw-v__VERSION__-__VERSIONHASH__-darwin-arm64.tar.xz" | ||
sha256 "__SHA_ARM64__" | ||
end | ||
end | ||
|
||
def install | ||
inreplace "bin/mw", /^CLIENT_HOME=/, "export HEROKU_OCLIF_CLIENT_HOME=#{lib/"client"}\nCLIENT_HOME=" | ||
libexec.install Dir["*"] | ||
bin.install_symlink libexec/"bin/mw" | ||
end | ||
|
||
test do | ||
system bin/"mw", "--version" | ||
end | ||
end |