From 9332255bebc48161c4be3fca4bc4ec2f3c4897a9 Mon Sep 17 00:00:00 2001 From: webadderall <131426131+webadderall@users.noreply.github.com> Date: Sun, 15 Mar 2026 00:47:24 +1100 Subject: [PATCH] ci(homebrew): automate tap cask updates from releases - Add workflow to download DMG assets, compute checksums, and update recordly cask in tap repo - Open PR automatically in tap repository on release publish or manual dispatch - Document Homebrew cask install and maintainer setup in README --- .github/workflows/homebrew-tap.yml | 147 +++++++++++++++++++++++++++++ README.md | 18 ++++ 2 files changed, 165 insertions(+) create mode 100644 .github/workflows/homebrew-tap.yml diff --git a/.github/workflows/homebrew-tap.yml b/.github/workflows/homebrew-tap.yml new file mode 100644 index 00000000..9377cae6 --- /dev/null +++ b/.github/workflows/homebrew-tap.yml @@ -0,0 +1,147 @@ +name: Update Homebrew Tap + +on: + release: + types: [published] + workflow_dispatch: + inputs: + tag: + description: "Release tag to publish to Homebrew tap (e.g. v1.0.5)" + required: true + type: string + tap_repo: + description: "Tap repository in owner/repo format" + required: false + default: "webadderall/homebrew-tap" + type: string + +permissions: + contents: read + +jobs: + update-tap: + runs-on: ubuntu-latest + env: + GH_TOKEN: ${{ secrets.HOMEBREW_TAP_TOKEN }} + TAP_REPO: ${{ github.event.inputs.tap_repo || vars.HOMEBREW_TAP_REPO || 'webadderall/homebrew-tap' }} + steps: + - name: Validate token + run: | + if [ -z "${GH_TOKEN}" ]; then + echo "HOMEBREW_TAP_TOKEN secret is not set." + exit 1 + fi + + - name: Resolve release tag + id: tag + shell: bash + run: | + if [ "${{ github.event_name }}" = "release" ]; then + TAG="${{ github.event.release.tag_name }}" + else + TAG="${{ github.event.inputs.tag }}" + fi + + if [ -z "$TAG" ]; then + echo "Release tag is empty" + exit 1 + fi + + VERSION="${TAG#v}" + echo "tag=$TAG" >> "$GITHUB_OUTPUT" + echo "version=$VERSION" >> "$GITHUB_OUTPUT" + + - name: Download release artifacts + shell: bash + run: | + mkdir -p /tmp/recordly-release + gh release download "${{ steps.tag.outputs.tag }}" \ + --repo "${{ github.repository }}" \ + --dir /tmp/recordly-release \ + --pattern "Recordly-arm64.dmg" \ + --pattern "Recordly-x64.dmg" + + - name: Compute checksums + id: sha + shell: bash + run: | + SHA_ARM=$(sha256sum /tmp/recordly-release/Recordly-arm64.dmg | awk '{print $1}') + SHA_INTEL=$(sha256sum /tmp/recordly-release/Recordly-x64.dmg | awk '{print $1}') + echo "arm=$SHA_ARM" >> "$GITHUB_OUTPUT" + echo "intel=$SHA_INTEL" >> "$GITHUB_OUTPUT" + + - name: Clone tap repository + shell: bash + run: | + gh repo clone "$TAP_REPO" /tmp/homebrew-tap + + - name: Update cask file + id: update + shell: bash + run: | + set -euo pipefail + cd /tmp/homebrew-tap + mkdir -p Casks + + BRANCH="recordly-cask-${{ steps.tag.outputs.tag }}" + git checkout -B "$BRANCH" + + cat > Casks/recordly.rb <<'RUBY' + cask "recordly" do + version "__VERSION__" + + on_arm do + sha256 "__SHA_ARM__" + url "https://github.com/__REPO__/releases/download/__TAG__/Recordly-arm64.dmg" + end + + on_intel do + sha256 "__SHA_INTEL__" + url "https://github.com/__REPO__/releases/download/__TAG__/Recordly-x64.dmg" + end + + name "Recordly" + desc "Open-source screen recorder and editor" + homepage "https://www.recordly.dev" + + app "Recordly.app" + end + RUBY + + sed -i "s/__VERSION__/${{ steps.tag.outputs.version }}/g" Casks/recordly.rb + sed -i "s/__SHA_ARM__/${{ steps.sha.outputs.arm }}/g" Casks/recordly.rb + sed -i "s/__SHA_INTEL__/${{ steps.sha.outputs.intel }}/g" Casks/recordly.rb + sed -i "s#__REPO__#${{ github.repository }}#g" Casks/recordly.rb + sed -i "s#__TAG__#${{ steps.tag.outputs.tag }}#g" Casks/recordly.rb + + if git diff --quiet; then + echo "changed=false" >> "$GITHUB_OUTPUT" + exit 0 + fi + + git config user.name "github-actions[bot]" + git config user.email "41898282+github-actions[bot]@users.noreply.github.com" + git add Casks/recordly.rb + git commit -m "chore(cask): update recordly to ${{ steps.tag.outputs.tag }}" + git push --force-with-lease origin "$BRANCH" + + echo "changed=true" >> "$GITHUB_OUTPUT" + echo "branch=$BRANCH" >> "$GITHUB_OUTPUT" + + - name: Open pull request in tap repo + if: steps.update.outputs.changed == 'true' + shell: bash + run: | + cd /tmp/homebrew-tap + + EXISTING=$(gh pr list --head "${{ steps.update.outputs.branch }}" --json number --jq 'length') + if [ "$EXISTING" -gt 0 ]; then + echo "PR already exists for ${{ steps.update.outputs.branch }}" + exit 0 + fi + + gh pr create \ + --title "chore(cask): update recordly to ${{ steps.tag.outputs.tag }}" \ + --body "Automated cask update for ${{ steps.tag.outputs.tag }}.\n\n- arm64 sha256: \\`${{ steps.sha.outputs.arm }}\\`\n- x64 sha256: \\`${{ steps.sha.outputs.intel }}\\`" \ + --head "${{ steps.update.outputs.branch }}" \ + --base main diff --git a/README.md b/README.md index 7ead1f24..84b06701 100644 --- a/README.md +++ b/README.md @@ -109,6 +109,24 @@ Prebuilt releases are available here: https://github.com/webadderall/Recordly/releases +## Homebrew (Cask) + +Recordly is distributed as a GUI app, so Homebrew support is done via cask. + +For users: + +```bash +brew tap webadderall/tap +brew install --cask recordly +``` + +For maintainers (automated tap updates): + +1. Create a tap repository (for example `webadderall/homebrew-tap`) with a `main` branch. +2. Add a repository secret in this repo: `HOMEBREW_TAP_TOKEN` (a token that can push branches and open PRs on the tap repo). +3. Optional: set repository variable `HOMEBREW_TAP_REPO` (defaults to `webadderall/homebrew-tap`). +4. On each published release, workflow `.github/workflows/homebrew-tap.yml` downloads release DMGs, computes checksums, updates `Casks/recordly.rb`, pushes a branch, and opens a PR in the tap repo. + --- ## Build from source