Skip to content

Publish to Homebrew on release#64

Merged
toddysm merged 4 commits into
mainfrom
feature/homebrew-publishing
Jul 2, 2026
Merged

Publish to Homebrew on release#64
toddysm merged 4 commits into
mainfrom
feature/homebrew-publishing

Conversation

@toddysm

@toddysm toddysm commented Jul 1, 2026

Copy link
Copy Markdown
Owner

No description provided.

Add Homebrew distribution alongside PyPI:
- New 'homebrew' job in publish.yml opens a formula-bump PR in
  toddysm/homebrew-regshape after the PyPI publish step
- .github/scripts/bump_formula.py resolves the released sdist URL/sha256
  from PyPI and rewrites the formula's top-level fields
- README + docs/guides/homebrew-install.md document brew install

Refs #59, #60, #62, #63
Copilot AI review requested due to automatic review settings July 1, 2026 05:13
Comment thread .github/workflows/publish.yml Fixed
Comment thread .github/scripts/bump_formula.py Fixed
Comment thread .github/scripts/bump_formula.py Fixed

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Pull request overview

Adds Homebrew release automation alongside the existing PyPI release workflow, and updates user-facing installation instructions accordingly.

Changes:

  • Update release workflow to also bump the Homebrew tap formula on GitHub Releases.
  • Add a Python helper script to rewrite the tap formula’s top-level url/sha256 from PyPI sdist metadata.
  • Update README installation instructions to include Homebrew.

Reviewed changes

Copilot reviewed 3 out of 4 changed files in this pull request and generated 4 comments.

File Description
README.md Adds Homebrew install instructions alongside existing pip/source install steps.
docs/guides/homebrew-install.md Introduced a Homebrew installation guide document.
.github/workflows/publish.yml Extends the release workflow with a Homebrew tap update job (opens a PR in the tap repo).
.github/scripts/bump_formula.py New script to fetch PyPI sdist URL/SHA and update the Homebrew formula.

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

Comment thread .github/workflows/publish.yml Outdated
Comment thread .github/workflows/publish.yml Outdated
Comment thread .github/workflows/publish.yml
Comment thread .github/scripts/bump_formula.py Outdated
- Validate formula path in bump_formula.py to prevent path traversal
  (resolve within CWD + require expected filename)
- Add explicit least-privilege 'contents: read' permissions to the
  publish workflow
Comment thread .github/scripts/bump_formula.py Fixed
Comment thread .github/scripts/bump_formula.py Fixed
toddysm added 2 commits July 1, 2026 18:03
Open a fixed 'Formula/regshape.rb' relative to the working directory instead
of a caller-supplied path, so no user data flows into a filesystem path. The
workflow runs the bumper from the tap checkout via working-directory: tap.
- Rename workflow to reflect it opens a formula-bump PR
- Use --force-with-lease instead of --force
- Make PR creation idempotent on workflow re-runs
- Reuse existing local branch with 'git switch -C'
@toddysm

toddysm commented Jul 2, 2026

Copy link
Copy Markdown
Owner Author

Review addressed:

  • Workflow name — renamed to "Publish to PyPI and bump Homebrew formula" to reflect that the job opens a bump PR.
  • git push --force — switched to --force-with-lease.
  • gh pr create on re-run — added an existence check so the bump job is idempotent.
  • File handles — the bumper now uses with open(...) context managers.
  • CodeQL path-injection — the script opens a constant Formula/regshape.rb (run via working-directory: tap), so no user data reaches a filesystem path. CodeQL now passes.

All checks green; resolving the (now outdated) threads.

@toddysm toddysm merged commit 80f0eb6 into main Jul 2, 2026
4 checks passed
@toddysm toddysm deleted the feature/homebrew-publishing branch July 2, 2026 01:08
toddysm added a commit that referenced this pull request Jul 2, 2026
The file was committed empty in #64; add the intended install/upgrade/
uninstall documentation.
toddysm added a commit that referenced this pull request Jul 2, 2026
* Restore Homebrew install guide content

The file was committed empty in #64; add the intended install/upgrade/
uninstall documentation.

* Address review: use 'Guide:' title prefix and fix brew tap hint
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.

3 participants