Skip to content

Add release workflow to sync Homebrew tap formula#856

Open
russellbrenner wants to merge 2 commits intoslopus:mainfrom
russellbrenner:automation/homebrew-tap-sync
Open

Add release workflow to sync Homebrew tap formula#856
russellbrenner wants to merge 2 commits intoslopus:mainfrom
russellbrenner:automation/homebrew-tap-sync

Conversation

@russellbrenner
Copy link

Summary

  • add a GitHub Actions workflow to update Formula/happy.rb in the Homebrew tap when a happy-coder release is published
  • support manual runs via workflow_dispatch with an explicit version
  • compute npm tarball SHA256 at runtime and update both URL and checksum in the tap formula

Configuration required

  • Add repository secret: HOMEBREW_TAP_GITHUB_TOKEN (token with write access to the tap repo)
  • Optional repository variable: HOMEBREW_TAP_REPO
    • defaults to russellbrenner/homebrew-happy
    • set to slopus/homebrew-happy after tap transfer

Why

Automates the Homebrew formula bump so releases stay in sync with npm without manual edits.

Co-Authored-By: Oz <oz-agent@warp.dev>
Copy link

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds a GitHub Actions workflow to automatically update the Homebrew tap formula for the happy CLI when a new happy-coder release is published (or when manually dispatched).

Changes:

  • Introduces .github/workflows/update-homebrew-tap.yml triggered on release.published and workflow_dispatch.
  • Computes the npm tarball SHA256 for a given version and updates the tap formula’s url and sha256.
  • Commits and pushes the updated formula to the configured tap repository.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

You can also share your feedback on Copilot code review. Take the survey.


perl -pi -e 's#^ url "https://registry\.npmjs\.org/happy-coder/-/happy-coder-[^"]+\.tgz"$# url "'"${{ steps.meta.outputs.tarball_url }}"'"#' "${FORMULA_FILE}"
perl -pi -e 's#^ sha256 "[0-9a-f]{64}"$# sha256 "'"${{ steps.shasum.outputs.sha256 }}"'"#' "${FORMULA_FILE}"

Comment on lines +94 to +108
- name: Commit and push formula update
shell: bash
run: |
set -euo pipefail
cd tap
if git diff --quiet; then
echo "No formula changes to commit."
exit 0
fi

git config user.name "happy-bot"
git config user.email "actions@users.noreply.github.com"
git add "${FORMULA_PATH}"
git commit -m "chore(homebrew): bump happy to ${{ steps.meta.outputs.version }}"
git push origin HEAD:main
Comment on lines +32 to +37
VERSION="${VERSION#v}"
else
echo "Unable to determine version. Provide workflow_dispatch input 'version' or release tag."
exit 1
fi

Co-Authored-By: Oz <oz-agent@warp.dev>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants