This guide explains how to set up automatic Homebrew package updates whenever a new release is created.
When you create a GitHub release, the automation will:
- ✅ Calculate SHA256 hash for the new release tarball
- ✅ Update Formula in the main repository
- ✅ Update Homebrew Tap repository automatically
- ✅ Create Tap Release with installation instructions
- ✅ Validate Everything to ensure it works
The automation needs permission to update the homebrew-codecompass repository.
-
Go to GitHub Settings:
- Visit: https://github.com/settings/tokens
- Click "Generate new token (classic)"
-
Configure Token:
- Note:
CodeCompass Homebrew Automation - Expiration: Choose appropriate duration (1 year recommended)
- Scopes (select these):
- ✅
repo(Full control of private repositories) - ✅
workflow(Update GitHub Action workflows) - ✅
write:packages(Upload packages to GitHub Package Registry)
- ✅
- Note:
-
Copy the Token (you won't see it again!)
-
Go to Repository Settings:
- Visit: https://github.com/xeon-zolt/codecompass/settings/secrets/actions
- Click "New repository secret"
-
Add Secret:
- Name:
HOMEBREW_TAP_TOKEN - Value: Paste the token you copied
- Click "Add secret"
- Name:
The automation is already configured in .github/workflows/homebrew-release.yml
# Create a test release
git tag -a v1.0.1-test -m "Test release for automation"
git push origin v1.0.1-test
# Create release on GitHub
gh release create v1.0.1-test --title "Test Release v1.0.1" --notes "Testing automation"# Trigger workflow manually
gh workflow run homebrew-release.yml -f version=v1.0.1-test- ✅ New GitHub release is published
- ✅ Manual workflow dispatch
graph LR
A[Release Created] --> B[Calculate SHA256]
B --> C[Update Main Formula]
C --> D[Update Tap Repository]
D --> E[Create Tap Release]
E --> F[Ready for Installation]
Formula/codecompass.rb(main repository)Formula/codecompass.rb(tap repository)- Release notes in tap repository
The HOMEBREW_TAP_TOKEN has access to:
- ✅ Update the
homebrew-codecompassrepository - ✅ Create releases in the tap repository
- ❌ NO access to other repositories
- ❌ NO admin permissions
If HOMEBREW_TAP_TOKEN is not available, the workflow will:
- Use
GITHUB_TOKEN(limited permissions) - Skip cross-repository updates
- Still update the main repository formula
# View recent workflow runs
gh run list --workflow=homebrew-release.yml
# View specific run details
gh run view <run-id># Check if tap is updated
brew tap xeon-zolt/codecompass
brew info codecompass
# Should show the latest version1. Token Expired
- Error:
Authentication failed - Solution: Generate new token and update secret
2. Permission Denied
- Error:
Permission denied (publickey) - Solution: Ensure token has correct scopes
3. Formula Validation Failed
- Error:
Ruby syntax error - Solution: Check formula syntax in main repository
1. Check Workflow Logs
gh run view --log2. Validate Token Permissions
# Test token access
curl -H "Authorization: token $HOMEBREW_TAP_TOKEN" \
https://api.github.com/repos/xeon-zolt/homebrew-codecompass3. Manual Formula Update
# Update tap repository manually
git clone https://github.com/xeon-zolt/homebrew-codecompass.git
cd homebrew-codecompass
# ... make updates ...
git pushTriggers:
release.types: [published]workflow_dispatch(manual)
Permissions:
contents: writepull-requests: write
Environment:
ubuntu-latest- Uses
HOMEBREW_TAP_TOKENor falls back toGITHUB_TOKEN
Key Steps:
- Checkout Repositories: Both main and tap repos
- Calculate SHA256: For release tarball
- Update Formulas: Both repositories with correct hash
- Create Release: In tap repository with installation instructions
- Validate: Ensure everything works correctly
- ⚡ Zero Manual Work - Releases update Homebrew automatically
- 🔒 Consistent Process - Same steps every time
- ✅ Error Prevention - Automated validation
- 📝 Documentation - Auto-generated release notes
- 🚀 Faster Updates - New versions available immediately
- 📦 Reliable Installation - Automated testing ensures it works
- 📋 Clear Instructions - Release notes include installation steps
Once automation is set up, releasing is simple:
# 1. Create and push tag
git tag -a v1.1.0 -m "Release v1.1.0 - New awesome features"
git push origin v1.1.0
# 2. Create GitHub release
gh release create v1.1.0 \
--title "🧭 CodeCompass v1.1.0" \
--notes "New features and improvements"
# 3. That's it! 🎉
# Automation handles:
# - Homebrew formula updates
# - Tap repository updates
# - Release creation
# - User notificationsUsers can then install with:
brew tap xeon-zolt/codecompass
brew install codecompass🤖 Automated Homebrew Updates - Set It and Forget It!