From 573f2435c8bd610ae504365b0fb1bb1a94e8d4b5 Mon Sep 17 00:00:00 2001 From: Wez Furlong Date: Sun, 5 Jul 2020 09:40:28 -0700 Subject: [PATCH] Automate updating linuxbrew tap refs: https://github.com/wez/wezterm/issues/239 --- .github/workflows/gen_ubuntu16_tag.yml | 14 ++++++++++++++ .gitignore | 1 + ci/appimage.sh | 3 ++- ci/generate-workflows.py | 24 ++++++++++++++++++++++++ ci/wezterm-homebrew-macos.rb.template | 1 + ci/wezterm-linuxbrew.rb.template | 17 +++++++++++++++++ 6 files changed, 59 insertions(+), 1 deletion(-) create mode 100644 ci/wezterm-linuxbrew.rb.template diff --git a/.github/workflows/gen_ubuntu16_tag.yml b/.github/workflows/gen_ubuntu16_tag.yml index f6df18a8e..92f96f4d8 100644 --- a/.github/workflows/gen_ubuntu16_tag.yml +++ b/.github/workflows/gen_ubuntu16_tag.yml @@ -88,3 +88,17 @@ jobs: commit_email: "wez@wezfurlong.org" ssh_private_key: "${{ secrets.AUR_SSH_PRIVATE_KEY }}" commit_message: "Automated update to match latest tag" + - name: "Checkout linuxbrew tap" + uses: actions/checkout@v2 + with: + repository: "wez/homebrew-wezterm-linuxbrew" + path: "linuxbrew-wezterm" + token: "${{ secrets.GH_PAT }}" + - name: "Update linuxbrew tap formula" + shell: bash + run: "cp wezterm-linuxbrew.rb linuxbrew-wezterm/Formula/wezterm.rb" + - name: "Commit linuxbrew tap changes" + uses: stefanzweifel/git-auto-commit-action@v4 + with: + commit_message: "Automated update to match latest tag" + repository: "linuxbrew-wezterm" diff --git a/.gitignore b/.gitignore index 9716c25a4..fb1f54be3 100644 --- a/.gitignore +++ b/.gitignore @@ -17,3 +17,4 @@ /WezTerm*.AppImage /WezTerm*.AppImage.zsync /wezterm*-src.tar.gz +/wezterm-linuxbrew.rb diff --git a/ci/appimage.sh b/ci/appimage.sh index f0c20f9b9..45e60031a 100755 --- a/ci/appimage.sh +++ b/ci/appimage.sh @@ -40,4 +40,5 @@ OUTPUT="$OUTPUT" \ # Update the AUR build file. We only really want to use this for tagged # builds but it doesn't hurt to generate it always here. SHA256=$(sha256sum $OUTPUT | cut -d' ' -f1) -sed -e "s/@TAG@/$TAG_NAME/" -e "s/@SHA256@/$SHA256/" < ci/PKGBUILD.template > PKGBUILD +sed -e "s/@TAG@/$TAG_NAME/g" -e "s/@SHA256@/$SHA256/g" < ci/PKGBUILD.template > PKGBUILD +sed -e "s/@TAG@/$TAG_NAME/g" -e "s/@SHA256@/$SHA256/g" < ci/wezterm-linuxbrew.rb.template > wezterm-linuxbrew.rb diff --git a/ci/generate-workflows.py b/ci/generate-workflows.py index 157ff146a..7d61f5d9b 100755 --- a/ci/generate-workflows.py +++ b/ci/generate-workflows.py @@ -365,6 +365,30 @@ cargo build --all --release""", }, ), ] + elif self.app_image: + steps += [ + ActionStep( + "Checkout linuxbrew tap", + action="actions/checkout@v2", + params={ + "repository": "wez/homebrew-wezterm-linuxbrew", + "path": "linuxbrew-wezterm", + "token": "${{ secrets.GH_PAT }}", + }, + ), + RunStep( + "Update linuxbrew tap formula", + "cp wezterm-linuxbrew.rb linuxbrew-wezterm/Formula/wezterm.rb", + ), + ActionStep( + "Commit linuxbrew tap changes", + action="stefanzweifel/git-auto-commit-action@v4", + params={ + "commit_message": "Automated update to match latest tag", + "repository": "linuxbrew-wezterm", + }, + ), + ] return steps diff --git a/ci/wezterm-homebrew-macos.rb.template b/ci/wezterm-homebrew-macos.rb.template index 7546a731a..5cf0b2dd9 100644 --- a/ci/wezterm-homebrew-macos.rb.template +++ b/ci/wezterm-homebrew-macos.rb.template @@ -8,6 +8,7 @@ class Wezterm < Formula homepage "https://wezfurlong.org/wezterm/" url "https://github.com/wez/wezterm/releases/download/@TAG@/WezTerm-macos-@TAG@.zip" sha256 "@SHA256@" + head "https://github.com/wez/wezterm/releases/download/nightly/WezTerm-macos-nightly.zip" def install prefix.install "WezTerm.app" diff --git a/ci/wezterm-linuxbrew.rb.template b/ci/wezterm-linuxbrew.rb.template new file mode 100644 index 000000000..d49185a81 --- /dev/null +++ b/ci/wezterm-linuxbrew.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-linuxbrew.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-@TAG@-Ubuntu16.04.AppImage" + sha256 "@SHA256@" + head "https://github.com/wez/wezterm/releases/download/nightly/WezTerm-nightly-Ubuntu16.04.AppImage" + + def install + Dir.glob("*.AppImage").each do |img| + bin.install img => "wezterm" + end + end +end