Conversation
There was a problem hiding this comment.
Pull Request Overview
This PR adds Homebrew package distribution support to the release workflow, enabling automatic formula updates for macOS users when new releases are published.
- Introduces a new
homebrewjob that runs after the main release job completes - Downloads the Darwin ARM64 binary and calculates its SHA256 hash for the Homebrew formula
- Uses the
mislav/bump-homebrew-formula-actionto automatically update the formula in thepgschema/homebrew-pgschematap
Tip: Customize your code reviews with copilot-instructions.md. Create the file or learn how to get started.
.github/workflows/release.yml
Outdated
| - name: Calculate SHA256 | ||
| id: sha256 | ||
| run: | | ||
| SHA256=$(shasum -a 256 ./dist/pgschema-darwin-arm64 | cut -d ' ' -f 1) | ||
| echo "sha256=${SHA256}" >> $GITHUB_OUTPUT | ||
|
|
||
| - name: Update Homebrew formula | ||
| uses: mislav/bump-homebrew-formula-action@v3 | ||
| with: | ||
| formula-name: pgschema | ||
| formula-path: Formula/pgschema.rb | ||
| homebrew-tap: pgschema/homebrew-pgschema | ||
| download-url: https://github.com/pgschema/pgschema/releases/download/v${{ steps.version.outputs.version }}/pgschema-darwin-arm64 |
There was a problem hiding this comment.
The download URL is hardcoded to only support Darwin ARM64 architecture. This limits Homebrew support to Apple Silicon Macs and excludes Intel-based Macs. Consider adding support for both architectures or using a universal binary.
| - name: Calculate SHA256 | |
| id: sha256 | |
| run: | | |
| SHA256=$(shasum -a 256 ./dist/pgschema-darwin-arm64 | cut -d ' ' -f 1) | |
| echo "sha256=${SHA256}" >> $GITHUB_OUTPUT | |
| - name: Update Homebrew formula | |
| uses: mislav/bump-homebrew-formula-action@v3 | |
| with: | |
| formula-name: pgschema | |
| formula-path: Formula/pgschema.rb | |
| homebrew-tap: pgschema/homebrew-pgschema | |
| download-url: https://github.com/pgschema/pgschema/releases/download/v${{ steps.version.outputs.version }}/pgschema-darwin-arm64 | |
| - name: Download Darwin AMD64 binary | |
| uses: actions/download-artifact@v4 | |
| with: | |
| name: pgschema-darwin-amd64 | |
| path: ./dist | |
| - name: Calculate SHA256 (ARM64) | |
| id: sha256_arm64 | |
| run: | | |
| SHA256=$(shasum -a 256 ./dist/pgschema-darwin-arm64 | cut -d ' ' -f 1) | |
| echo "sha256=${SHA256}" >> $GITHUB_OUTPUT | |
| - name: Calculate SHA256 (AMD64) | |
| id: sha256_amd64 | |
| run: | | |
| SHA256=$(shasum -a 256 ./dist/pgschema-darwin-amd64 | cut -d ' ' -f 1) | |
| echo "sha256=${SHA256}" >> $GITHUB_OUTPUT | |
| - name: Update Homebrew formula | |
| uses: mislav/bump-homebrew-formula-action@v3 | |
| with: | |
| formula-name: pgschema | |
| formula-path: Formula/pgschema.rb | |
| homebrew-tap: pgschema/homebrew-pgschema | |
| download-url-arm64: https://github.com/pgschema/pgschema/releases/download/v${{ steps.version.outputs.version }}/pgschema-darwin-arm64 | |
| sha256-arm64: ${{ steps.sha256_arm64.outputs.sha256 }} | |
| download-url-amd64: https://github.com/pgschema/pgschema/releases/download/v${{ steps.version.outputs.version }}/pgschema-darwin-amd64 | |
| sha256-amd64: ${{ steps.sha256_amd64.outputs.sha256 }} |
There was a problem hiding this comment.
Only apple silicon
.github/workflows/release.yml
Outdated
| - name: Calculate SHA256 | ||
| id: sha256 | ||
| run: | | ||
| SHA256=$(shasum -a 256 ./dist/pgschema-darwin-arm64 | cut -d ' ' -f 1) | ||
| echo "sha256=${SHA256}" >> $GITHUB_OUTPUT | ||
|
|
There was a problem hiding this comment.
The SHA256 calculation is computed but the sha256 output is not used in the homebrew formula update action. The action likely calculates the hash automatically from the download URL, making this step redundant.
| - name: Calculate SHA256 | |
| id: sha256 | |
| run: | | |
| SHA256=$(shasum -a 256 ./dist/pgschema-darwin-arm64 | cut -d ' ' -f 1) | |
| echo "sha256=${SHA256}" >> $GITHUB_OUTPUT |
For #74