diff --git a/.github/workflows/gen_macos_tag.yml b/.github/workflows/gen_macos_tag.yml index 835b4159b..256dc4d11 100644 --- a/.github/workflows/gen_macos_tag.yml +++ b/.github/workflows/gen_macos_tag.yml @@ -88,3 +88,20 @@ jobs: files: "WezTerm-*.zip" env: GITHUB_TOKEN: "${{ secrets.GITHUB_TOKEN }}" + - name: "Checkout homebrew tap" + uses: actions/checkout@v2 + with: + repository: "wez/homebrew-wezterm" + path: "homebrew-wezterm" + - name: "Update homebrew tap formula" + shell: bash + run: | + export MACOSX_DEPLOYMENT_TARGET=10.9 + cp wezterm.rb $GITHUB_WORKSPACE/Formula/wezterm.rb + + + - name: "Commit homebrew tap changes" + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "Automated update to match latest tag" + repository: "$GITHUB_WORKSPACE/homebrew-wezterm" diff --git a/ci/deploy.sh b/ci/deploy.sh index 6eae0af09..6d2b49d67 100755 --- a/ci/deploy.sh +++ b/ci/deploy.sh @@ -30,6 +30,11 @@ case $OSTYPE in cp $TARGET_DIR/release/strip-ansi-escapes $zipdir/WezTerm.app cp -r assets/colors $zipdir/WezTerm.app/Contents/Resources/ zip -r $zipname $zipdir + + SHA256=$(shasum -a 256 $zipname | cut -d' ' -f1) + sed -e "s/@TAG@/$TAG_NAME/" -e "s/@SHA256@/$SHA256/" < ci/wezterm-homebrew-macos.rb.template > wezterm.rb + cat wezterm.rb + ;; msys) zipdir=WezTerm-windows-$TAG_NAME diff --git a/ci/generate-workflows.py b/ci/generate-workflows.py index 667388cc0..3f5756576 100755 --- a/ci/generate-workflows.py +++ b/ci/generate-workflows.py @@ -339,6 +339,34 @@ cargo build --all --release""", ) ] + def update_homebrew_tap(self): + steps = [] + if "macos" in self.name: + steps += [ + ActionStep( + "Checkout homebrew tap", + action="actions/checkout@v2", + params={ + "repository": "wez/homebrew-wezterm", + "path": "homebrew-wezterm", + }, + ), + RunStep( + "Update homebrew tap formula", + "cp wezterm.rb $GITHUB_WORKSPACE/Formula/wezterm.rb", + ), + ActionStep( + "Commit homebrew tap changes", + action="stefanzweifel/git-auto-commit-action@v4", + params={ + "commit_message": "Automated update to match latest tag", + "repository": "$GITHUB_WORKSPACE/homebrew-wezterm", + }, + ), + ] + + return steps + def update_tagged_aur(self): steps = [] @@ -436,6 +464,7 @@ cargo build --all --release""", steps += self.package() steps += self.upload_asset_tag() steps += self.update_tagged_aur() + steps += self.update_homebrew_tap() env = self.global_env() return Job(runs_on=self.os, container=self.container, steps=steps, env=env,) diff --git a/ci/wezterm-homebrew-macos.rb.template b/ci/wezterm-homebrew-macos.rb.template new file mode 100644 index 000000000..b96da4265 --- /dev/null +++ b/ci/wezterm-homebrew-macos.rb.template @@ -0,0 +1,17 @@ +# Note: if you are viewing this from the tap repo, this file is automatically +# updated from: +# https://github.com/wez/wezterm/blob/master/ci/wezterm-homebrew-macos.rb.template +# by automation in the wezterm repo. + +class Wezterm < Formula + desc "A GPU-accelerated cross-platform terminal emulator and multiplexer written by @wez and implemented in Rust" + homepage "https://wezfurlong.org/wezterm/" + url "https://github.com/wez/wezterm/releases/download/@TAG@/WezTerm-macos-@TAG@.zip" + sha256 "@SHA256@" + + def install + prefix.install "WezTerm.app" + bin.write_exec_script "#{prefix}/WezTerm.app/wezterm" + end +end +