Skip to content

feat: Auto-update Homebrew tap on release (closes #28)#31

Merged
fummicc1 merged 2 commits into
mainfrom
feat/homebrew-tap-auto-update
Jun 20, 2026
Merged

feat: Auto-update Homebrew tap on release (closes #28)#31
fummicc1 merged 2 commits into
mainfrom
feat/homebrew-tap-auto-update

Conversation

@fummicc1

@fummicc1 fummicc1 commented Jun 20, 2026

Copy link
Copy Markdown
Owner

Summary

Completes the brew install fummicc1/tap/swift-complexity distribution requested in #28.

The tap repository fummicc1/homebrew-tap and its formulae (swift-complexity.rb / swift-complexity-mcp.rb) were already bootstrapped manually for v0.1.0, but this repository was missing (1) a mechanism to keep the formulae in sync with every release, and (2) brew install instructions in the README. This PR fills both gaps.

Changes

  • .github/scripts/update_formula.py (new): Rewrites the version and per-architecture sha256 fields by fetching the .sha256 assets attached to the release. It anchors on each formula url line to map the immediately following sha256 line, so it handles the multi-arch on_macos/on_linux block layout without positional fragility. Standard library only.
  • .github/workflows/release.yml: Adds an update-homebrew-tap job. It runs after create-release, only for non-prereleases. It checks out the tap with a GitHub App token (not a PAT), updates both formulae via the script, then commits & pushes.
  • README.md: Documents brew install in the CLI and MCP Installation sections.

Prerequisites (post-merge user action ⚠️)

The auto-update job requires the following, which cannot be configured in code:

  1. Create a GitHub App owned by fummicc1 with Contents: Read and write permission, installed on fummicc1/homebrew-tap.
  2. Register the secrets HOMEBREW_TAP_APP_ID and HOMEBREW_TAP_APP_PRIVATE_KEY in this repository.

If unset, only this job fails; the release itself (create-release) is unaffected.

Verification

  • Reproduction test: Running update_formula.py 0.1.0 against the current tap formulae reproduces the existing version and sha256 values exactly (idempotency proves the substitution logic is correct).
  • python3 ast.parse confirms valid syntax.
  • actionlint parses release.yml successfully (warnings are limited to pre-existing steps; the new job is clean).
  • ✅ Verified the brew install formatting in the README.

https://claude.ai/code/session_01QvZLELvJyEvSiR4SadiSt2

The fummicc1/homebrew-tap formulae were bootstrapped manually for v0.1.0,
so they would drift from every subsequent release without a sync step.

Add an update-homebrew-tap job that, on each non-prerelease tag, fetches
the per-arch .sha256 release assets and rewrites the version and sha256
fields in both tap formulae, then pushes via a GitHub App token (no PAT).
The patch script anchors on each formula url line so it handles the
multi-arch on_macos/on_linux block layout without positional fragility.

Also document brew install in the CLI and MCP README sections.

Claude-Session: https://claude.ai/code/session_01QvZLELvJyEvSiR4SadiSt2
@github-actions

Copy link
Copy Markdown

📊 PR Analysis

Type Count
Swift files 0
Test files 0
Documentation 1
Configuration 1

Automated analysis by swift-complexity CI

@github-actions

Copy link
Copy Markdown

🔍 Complexity Analysis Results

✅ All functions are below the complexity threshold of 15.

This analysis was performed by swift-complexity itself.

Use the App's own bot identity (fummicc1-app[bot]) for tap commits instead
of github-actions[bot], resolving the slug and numeric user id from the App
token so the noreply email is valid and commits verify under the App.

Claude-Session: https://claude.ai/code/session_01QvZLELvJyEvSiR4SadiSt2
@github-actions

Copy link
Copy Markdown

📊 PR Analysis

Type Count
Swift files 0
Test files 0
Documentation 1
Configuration 1

Automated analysis by swift-complexity CI

@fummicc1
fummicc1 enabled auto-merge (squash) June 20, 2026 17:53
@github-actions

Copy link
Copy Markdown

🔍 Complexity Analysis Results

✅ All functions are below the complexity threshold of 15.

This analysis was performed by swift-complexity itself.

@fummicc1
fummicc1 merged commit 33a2d93 into main Jun 20, 2026
7 checks passed
@fummicc1
fummicc1 deleted the feat/homebrew-tap-auto-update branch June 20, 2026 17:56
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.

1 participant