Skip to content

Commit

Permalink
Update
Browse files Browse the repository at this point in the history
  • Loading branch information
qianlifeng committed Aug 7, 2024
1 parent 5163a0d commit 44dd932
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions .github/workflows/update_cask.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,25 +13,27 @@ jobs:

- name: Update cask
run: |
LATEST_RELEASE_VERSION=$(curl --silent "https://api.github.com/repos/wox-launcher/wox/releases/latest" | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')
echo "Latest version: $LATEST_RELEASE_VERSION"
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_FILENAME=$(curl --silent "https://api.github.com/repos/wox-launcher/wox/releases/latest" | grep 'mac-arm64' | sed -n 's/.*"name": "\(.*\)".*/\1/p')
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
sed -i "s/version .*/version \"v${LATEST_RELEASE_VERSION}\"/" Casks/wox.rb
sed -i "/on_arm do/,/end/ s/sha256 .*/sha256 \"${LATEST_ARM64_SHA}\"/" Casks/wox.rb
sed -i "/on_intel do/,/end/ s/sha256 .*/sha256 \"${LATEST_AMD64_SHA}\"/" Casks/wox.rb
echo "LATEST_RELEASE_VERSION=$LATEST_RELEASE_VERSION" >> $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 }}"
COMMIT_MSG="Update Wox cask to v${{ env.LATEST_RELEASE_VERSION }}"
git config --local user.email "[email protected]"
git config --local user.name "GitHub Action"
git add Casks/wox.rb
Expand Down

0 comments on commit 44dd932

Please sign in to comment.