Skip to content

Commit 35f88b2

Browse files
committed
Add homebrew installer
1 parent 488cd14 commit 35f88b2

3 files changed

Lines changed: 58 additions & 4 deletions

File tree

.github/workflows/release.yml

Lines changed: 47 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -286,14 +286,60 @@ jobs:
286286
287287
gh release create "${{ needs.plan.outputs.tag }}" --target "$RELEASE_COMMIT" $PRERELEASE_FLAG --title "$ANNOUNCEMENT_TITLE" --notes-file "$RUNNER_TEMP/notes.txt" artifacts/*
288288
289+
publish-homebrew-formula:
290+
needs:
291+
- plan
292+
- host
293+
runs-on: "ubuntu-22.04"
294+
env:
295+
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}
296+
PLAN: ${{ needs.plan.outputs.val }}
297+
GITHUB_USER: "axo bot"
298+
GITHUB_EMAIL: "admin+bot@axo.dev"
299+
if: ${{ !fromJson(needs.plan.outputs.val).announcement_is_prerelease || fromJson(needs.plan.outputs.val).publish_prereleases }}
300+
steps:
301+
- uses: actions/checkout@v4
302+
with:
303+
repository: "oxidecomputer/homebrew-tap"
304+
token: ${{ secrets.HOMEBREW_TAP_TOKEN }}
305+
# So we have access to the formula
306+
- name: Fetch homebrew formulae
307+
uses: actions/download-artifact@v4
308+
with:
309+
pattern: artifacts-*
310+
path: Formula/
311+
merge-multiple: true
312+
# This is extra complex because you can make your Formula name not match your app name
313+
# so we need to find releases with a *.rb file, and publish with that filename.
314+
- name: Commit formula files
315+
run: |
316+
git config --global user.name "${GITHUB_USER}"
317+
git config --global user.email "${GITHUB_EMAIL}"
318+
319+
for release in $(echo "$PLAN" | jq --compact-output '.releases[] | select([.artifacts[] | endswith(".rb")] | any)'); do
320+
filename=$(echo "$release" | jq '.artifacts[] | select(endswith(".rb"))' --raw-output)
321+
name=$(echo "$filename" | sed "s/\.rb$//")
322+
version=$(echo "$release" | jq .app_version --raw-output)
323+
324+
export PATH="/home/linuxbrew/.linuxbrew/bin:$PATH"
325+
brew update
326+
# We avoid reformatting user-provided data such as the app description and homepage.
327+
brew style --except-cops FormulaAudit/Homepage,FormulaAudit/Desc,FormulaAuditStrict --fix "Formula/${filename}" || true
328+
329+
git add "Formula/${filename}"
330+
git commit -m "${name} ${version}"
331+
done
332+
git push
333+
289334
announce:
290335
needs:
291336
- plan
292337
- host
338+
- publish-homebrew-formula
293339
# use "always() && ..." to allow us to wait for all publish jobs while
294340
# still allowing individual publish jobs to skip themselves (for prereleases).
295341
# "host" however must run to completion, no skipping allowed!
296-
if: ${{ always() && needs.host.result == 'success' }}
342+
if: ${{ always() && needs.host.result == 'success' && (needs.publish-homebrew-formula.result == 'skipped' || needs.publish-homebrew-formula.result == 'success') }}
297343
runs-on: "ubuntu-22.04"
298344
env:
299345
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }}

CHANGELOG.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
Nothing Yet!
44

5+
# Version 1.0.5
6+
7+
- Enable homebrew installer.
8+
59
# Version 1.0.4 (2025-07-02)
610

711
- Build dist with v1.0.3 for signed and notarized macOS binaries.

dist-workspace.toml

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,21 +8,25 @@ cargo-dist-version = "1.0.4"
88
# CI backends to support
99
ci = "github"
1010
# The installers to generate for each app
11-
installers = ["shell", "powershell"]
11+
installers = ["shell", "powershell", "homebrew"]
1212
# Target platforms to build apps for (Rust target-triple syntax)
1313
targets = ["aarch64-apple-darwin", "aarch64-unknown-linux-gnu", "aarch64-unknown-linux-musl", "x86_64-apple-darwin", "x86_64-unknown-linux-gnu", "x86_64-unknown-linux-musl", "x86_64-pc-windows-msvc"]
1414
# Which actions to run on pull requests
1515
pr-run-mode = "plan"
1616
# Where to host releases
17-
hosting = ["github"]
17+
hosting = "github"
1818
# Whether to install an updater program
1919
install-updater = false
2020
# Whether to enable GitHub Attestations
2121
github-attestations = true
2222
# Path that installers should place binaries in
2323
install-path = "CARGO_HOME"
24-
# Sign macOS binaries
24+
# Whether to sign macOS executables
2525
macos-sign = true
26+
# A GitHub repo to push Homebrew formulas to
27+
tap = "oxidecomputer/homebrew-tap"
28+
# Publish jobs to run in CI
29+
publish-jobs = ["homebrew"]
2630

2731
[[dist.extra-artifacts]]
2832
artifacts = ["dist-manifest-schema.json"]

0 commit comments

Comments
 (0)