From c9fd2eb76aa65b217e6f38972f62a7a2411f2d36 Mon Sep 17 00:00:00 2001 From: qianlifeng Date: Wed, 7 Aug 2024 22:37:04 +0800 Subject: [PATCH] Initial --- .github/workflows/update_cask.yml | 39 +++++++++++++++++++++++++++++++ Casks/wox.rb | 23 ++++++++++++++++++ 2 files changed, 62 insertions(+) create mode 100644 .github/workflows/update_cask.yml create mode 100644 Casks/wox.rb diff --git a/.github/workflows/update_cask.yml b/.github/workflows/update_cask.yml new file mode 100644 index 0000000..da98b0f --- /dev/null +++ b/.github/workflows/update_cask.yml @@ -0,0 +1,39 @@ +name: Update Wox Cask + +on: + workflow_dispatch: # only dispatch manually + +jobs: + update_cask: + runs-on: ubuntu-latest + + steps: + - name: Check out repository + uses: actions/checkout@v2 + + - name: Update cask + run: | + LATEST_AMD64_FILENAME=$(curl --silent "https://api.github.com/repos/wox-launcher/wox/releases/latest" | grep 'mac-amd64' | sed -n 's/.*"name": "\(.*\)".*/\1/p') + LATEST_AMD64_RELEASE=$(curl --silent "https://api.github.com/repos/wox-launcher/wox/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/') + LATEST_AMD64_SHA=$(curl -sL "https://github.com/localsend/wox-launcher/releases/download/v${LATEST_RELEASE}/${LATEST_AMD64_FILENAME}" | sha256sum | cut -f 1 -d " ") + echo "Latest amd64 release: $LATEST_AMD64_RELEASE" + echo "Latest amd64 SHA: $LATEST_AMD64_SHA" + + LATEST_ARM64_FILENAME=$(curl --silent "https://api.github.com/repos/wox-launcher/wox/releases/latest" | grep 'mac-amd64' | sed -n 's/.*"name": "\(.*\)".*/\1/p') + LATEST_ARM64_RELEASE=$(curl --silent "https://api.github.com/repos/wox-launcher/wox/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/') + LATEST_ARM64_SHA=$(curl -sL "https://github.com/localsend/wox-launcher/releases/download/v${LATEST_RELEASE}/${LATEST_ARM64_FILENAME}" | sha256sum | cut -f 1 -d " ") + echo "Latest arm64 release: $LATEST_ARM64_RELEASE" + echo "Latest arm64 SHA: $LATEST_ARM64_SHA" + + echo "LATEST_AMD64_RELEASE=$LATEST_AMD64_RELEASE" >> $GITHUB_ENV + + - name: Commit and push changes + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + run: | + COMMIT_MSG="Update Wox cask to v${{ env.LATEST_AMD64_RELEASE }}" + git config --local user.email "action@github.com" + git config --local user.name "GitHub Action" + git add Casks/wox.rb + git commit -m "$COMMIT_MSG" + git push \ No newline at end of file diff --git a/Casks/wox.rb b/Casks/wox.rb new file mode 100644 index 0000000..8924bc8 --- /dev/null +++ b/Casks/wox.rb @@ -0,0 +1,23 @@ +cask "wox" do + arch arm: "arm64", intel: "x86_64" + + on_arm do + version "v2.0.0-nightly" + sha256 "aae104dc1267ad6da27c6deb506c6048b03848a95a7c42ad953297516c8e419d" + filename "wox-mac-arm64-20240807-5c43a4.dmg" + end + on_intel do + version "v2.0.0-nightly" + sha256 "d57314b3c9243fa9e5df1a6a169e464ec3b4c5bca536a0edcae5d57a3ed53bd1" + filename "wox-mac-amd64-20240807-a78e72.dmg" + end + + url "https://github.com/Wox-launcher/Wox/releases/download/#{version}/#{filename}" + name "Wox" + desc "A cross-platform launcher that simply works" + homepage "https://github.com/Wox-launcher/Wox" + + depends_on macos: ">= :big_sur" + + app "Wox.app" + end \ No newline at end of file