name: Update Homebrew Cask on: release: types: [published] workflow_dispatch: jobs: update-cask: runs-on: macos-latest permissions: contents: write steps: - uses: actions/checkout@v4 - name: Download and hash release id: release run: | VERSION="${{ github.event.release.tag_name || github.ref_name }}" curl -L -o plezy-macos.dmg \ "https://github.com/edde746/plezy/releases/download/$VERSION/plezy-macos.dmg" SHA256=$(shasum -a 256 plezy-macos.dmg | cut -d' ' -f1) echo "version=$VERSION" >> $GITHUB_OUTPUT echo "sha256=$SHA256" >> $GITHUB_OUTPUT - name: Update cask run: | sed -i '' "s/version \".*\"/version \"${{ steps.release.outputs.version }}\"/" Casks/plezy.rb sed -i '' "s/sha256 \".*\"/sha256 \"${{ steps.release.outputs.sha256 }}\"/" Casks/plezy.rb - name: Commit run: | git config user.name "github-actions[bot]" git config user.email "github-actions[bot]@users.noreply.github.com" git add Casks/plezy.rb git diff --staged --quiet || git commit -m "chore: update cask to ${{ steps.release.outputs.version }}" git push