mirror of
https://github.com/vitorpamplona/amethyst.git
synced 2026-10-30 07:37:38 +00:00
The amethyst-nostr cask and the amy formula are on Homebrew's autobump list, so BrewTestBot opens their version PRs and `brew bump-cask-pr` refuses to open a competing one (it errored on v1.17.0). scripts/bump-homebrew-cask.sh keeps re-verifying the live DMG's sha256 and stapled notarization (BrewTestBot checks neither against ours), then finds BrewTestBot's PR and fails if its sha256 differs. No token is needed. It falls back to `brew bump-cask-pr` only if the cask leaves autobump. RELEASE_OPS.md, BUILDING.md and the sync workflows now describe that flow, drop the per-release HOMEBREW_GITHUB_API_TOKEN step, and record that winget is live (initial PR merged 2026-09-23). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
169 lines
7.5 KiB
YAML
169 lines
7.5 KiB
YAML
name: Bump Homebrew Formula (amy CLI)
|
|
|
|
# Sibling of bump-homebrew.yml, but for a DIFFERENT Homebrew artifact:
|
|
# - bump-homebrew.yml -> Cask `amethyst-nostr` (the desktop GUI app / DMG)
|
|
# - this workflow -> Formula `amy` (the headless CLI jar bundle)
|
|
#
|
|
# What it does today: after a stable release, download the published
|
|
# `amy-<version>-jvm.tar.gz` bundle, compute its sha256, and open a PR that
|
|
# syncs `cli/packaging/homebrew/amy.rb`'s url + sha256 to that release. That is
|
|
# exactly the manual step the formula header calls out ("replace the version in
|
|
# the url and the sha256 with the values for the actual published release
|
|
# asset"), so keeping the in-repo reference formula accurate makes the eventual
|
|
# homebrew-core submission a copy-paste.
|
|
#
|
|
# What it does NOT do yet: open a PR against Homebrew/homebrew-core. `brew
|
|
# bump-formula-pr` can only bump a formula that already EXISTS in homebrew-core,
|
|
# and `amy` has never been submitted there — that first submission is a manual,
|
|
# human-reviewed new-formula PR (the one-time bootstrap). Once it lands, wire the
|
|
# auto-bump here (symmetric to the cask action in bump-homebrew.yml) — see the
|
|
# "TODO(bootstrap)" note at the bottom of this file.
|
|
|
|
# Trigger: after "Create Release Assets" succeeds for a tag push. NOT
|
|
# `release: types: [released]` — that event never fires, because the release is
|
|
# created by create-release.yml under GITHUB_TOKEN and GitHub suppresses
|
|
# workflow-triggering events for it. See the full note in bump-homebrew.yml.
|
|
on:
|
|
workflow_run:
|
|
workflows: ["Create Release Assets"]
|
|
types: [completed]
|
|
workflow_dispatch:
|
|
inputs:
|
|
tag:
|
|
description: 'Release tag to sync (for manual recovery)'
|
|
required: true
|
|
type: string
|
|
|
|
permissions:
|
|
contents: write
|
|
pull-requests: write
|
|
# The "Report failure" step opens a [release-ops] issue via
|
|
# github.rest.issues.create, which needs issues:write.
|
|
issues: write
|
|
|
|
concurrency:
|
|
# Serialize per tag; do not cancel in-progress runs.
|
|
group: bump-homebrew-formula-${{ github.event.workflow_run.head_branch || inputs.tag }}
|
|
cancel-in-progress: false
|
|
|
|
jobs:
|
|
sync-formula:
|
|
# See bump-homebrew.yml for why these three conditions: successful, tag-push
|
|
# (not a dry-run dispatch), v-prefixed. Exact format enforced downstream.
|
|
if: >-
|
|
github.event_name == 'workflow_dispatch' ||
|
|
(github.event.workflow_run.conclusion == 'success' &&
|
|
github.event.workflow_run.event == 'push' &&
|
|
startsWith(github.event.workflow_run.head_branch, 'v'))
|
|
runs-on: ubuntu-latest
|
|
timeout-minutes: 15
|
|
steps:
|
|
- name: Checkout code
|
|
uses: actions/checkout@v7
|
|
|
|
- name: Resolve release
|
|
id: rel
|
|
uses: ./.github/actions/resolve-release
|
|
with:
|
|
tag: ${{ github.event.workflow_run.head_branch || inputs.tag }}
|
|
github_token: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
- name: Re-assert stable release
|
|
uses: ./.github/actions/assert-stable-release
|
|
with:
|
|
tag: ${{ steps.rel.outputs.tag }}
|
|
is_prerelease: ${{ steps.rel.outputs.is_prerelease }}
|
|
is_draft: ${{ steps.rel.outputs.is_draft }}
|
|
|
|
- name: Download jvm bundle and compute sha256
|
|
id: asset
|
|
run: |
|
|
set -euo pipefail
|
|
TAG="${{ steps.rel.outputs.tag }}"
|
|
VER="${{ steps.rel.outputs.ver }}"
|
|
URL="https://github.com/${{ github.repository }}/releases/download/${TAG}/amy-${VER}-jvm.tar.gz"
|
|
echo "Fetching $URL"
|
|
# workflow_run fires only after every upload leg has finished, so the
|
|
# asset should already be there. Retry anyway for release-CDN
|
|
# propagation (mirrors the repo's push/pull retry ethos).
|
|
ok=0
|
|
for i in 1 2 3 4 5; do
|
|
if curl -fsSL -o amy-jvm.tar.gz "$URL"; then ok=1; break; fi
|
|
wait=$(( 2 ** i ))
|
|
echo "attempt $i failed; retrying in ${wait}s"
|
|
sleep "$wait"
|
|
done
|
|
[[ "$ok" == 1 ]] || { echo "::error::could not download $URL"; exit 1; }
|
|
test -s amy-jvm.tar.gz
|
|
SHA=$(shasum -a 256 amy-jvm.tar.gz | awk '{print $1}')
|
|
echo "url=$URL" >> "$GITHUB_OUTPUT"
|
|
echo "sha256=$SHA" >> "$GITHUB_OUTPUT"
|
|
echo "amy-${VER}-jvm.tar.gz -> $SHA"
|
|
|
|
- name: Update reference formula
|
|
run: |
|
|
set -euo pipefail
|
|
FORMULA=cli/packaging/homebrew/amy.rb
|
|
URL="${{ steps.asset.outputs.url }}"
|
|
SHA="${{ steps.asset.outputs.sha256 }}"
|
|
# Rewrite the two indented lines in the formula block. Anchoring on the
|
|
# 2-space indent avoids touching the header comment's example curl url.
|
|
sed -i -E "s|^( url ).*|\1\"${URL}\"|" "$FORMULA"
|
|
sed -i -E "s|^( sha256 ).*|\1\"${SHA}\"|" "$FORMULA"
|
|
echo "----- $FORMULA -----"
|
|
grep -E "^ (url|sha256) " "$FORMULA"
|
|
|
|
- name: Open or update the formula-sync PR
|
|
# peter-evans/create-pull-request is MIT-licensed CI-only tooling (not
|
|
# linked into any shipped artifact). It no-ops when there is no diff.
|
|
uses: peter-evans/create-pull-request@v8
|
|
with:
|
|
token: ${{ secrets.GITHUB_TOKEN }}
|
|
base: main
|
|
branch: chore/bump-amy-formula-${{ steps.rel.outputs.tag }}
|
|
add-paths: cli/packaging/homebrew/amy.rb
|
|
commit-message: 'chore: sync amy Homebrew formula to ${{ steps.rel.outputs.tag }}'
|
|
title: 'chore: sync amy Homebrew formula to ${{ steps.rel.outputs.tag }}'
|
|
body: |
|
|
Auto-synced `cli/packaging/homebrew/amy.rb` to the
|
|
`${{ steps.rel.outputs.tag }}` release:
|
|
|
|
- `url` -> `${{ steps.asset.outputs.url }}`
|
|
- `sha256` -> `${{ steps.asset.outputs.sha256 }}`
|
|
|
|
Opened by `.github/workflows/bump-homebrew-formula.yml`. Merge to keep
|
|
the reference formula ready for the homebrew-core submission/bump.
|
|
|
|
# `amy` is in Homebrew/homebrew-core and on its autobump list: BrewTestBot
|
|
# opens and merges the version PR itself (v1.17.0: homebrew-core#315679),
|
|
# so nothing on our side pushes upstream. Do NOT add a `brew
|
|
# bump-formula-pr` step to CI: Homebrew refuses it for autobumped
|
|
# formulae, and it would need a classic `repo`-scoped PAT that reaches
|
|
# every repo the account can write to. See BUILDING.md § Package-manager
|
|
# credentials.
|
|
|
|
- name: Report failure
|
|
if: failure()
|
|
uses: actions/github-script@v9
|
|
with:
|
|
script: |
|
|
const tag = context.payload.workflow_run?.head_branch || context.payload.inputs?.tag || 'unknown';
|
|
const runUrl = `${context.serverUrl}/${context.repo.owner}/${context.repo.repo}/actions/runs/${context.runId}`;
|
|
await github.rest.issues.create({
|
|
owner: context.repo.owner,
|
|
repo: context.repo.repo,
|
|
title: `[release-ops] bump-homebrew-formula failed for ${tag}`,
|
|
body: [
|
|
`amy Homebrew formula sync failed for release \`${tag}\`.`,
|
|
``,
|
|
`- Run: ${runUrl}`,
|
|
`- Channel: Homebrew Formula (\`amy\` CLI)`,
|
|
``,
|
|
`Recovery options:`,
|
|
`1. Re-run the workflow once the underlying issue is fixed`,
|
|
`2. Manually update \`cli/packaging/homebrew/amy.rb\` (url + sha256) from the release asset`,
|
|
`3. Check the release actually published \`amy-${tag.replace(/^v/, '')}-jvm.tar.gz\``
|
|
].join('\n'),
|
|
labels: ['release-ops', 'bug']
|
|
});
|