Files
floci-cli/.github/workflows/homebrew-bump.yml
T
Hector Ventura ae4bf99352 ci: release with release-please, like the Testcontainers modules (#76)
Replace the semantic-release Release Cut button with release-please.yml:
a standing release PR bumps pom.xml and CHANGELOG.md; merging it tags
X.Y.Z, then the workflow publishes the binaries (release.yml, now a
reusable workflow), bumps the Homebrew tap and runs CodeQL and Trivy.
A workflow_dispatch tag input re-publishes an existing tag.

Swap conventional-commits.yml for commit-lint.yml so the PR title is
linted, exempt release PRs from the changelog guard, and demote the
generated changelog headings so release-please inserts above them.

Tests: mvn -B test, 811 passed.

Signed-off-by: Hector Ventura <hectorvent@gmail.com>
2026-11-05 21:30:19 -06:00

80 lines
3.3 KiB
YAML

name: Homebrew Bump
# Called by release-please.yml after the publish job has attached the binaries to the release.
# Opens a PR in floci-io/homebrew-floci with the new version and SHA256.
#
# Required secrets: GH_TOKEN (PAT with repo scope on homebrew-floci repo)
on:
workflow_call:
inputs:
tag:
description: Release tag whose binaries the formula should point at (e.g. 0.5.0)
required: true
type: string
permissions:
contents: read
jobs:
bump:
name: Bump Homebrew formula
runs-on: ubuntu-latest
timeout-minutes: 10
steps:
- name: Extract version from tag
id: version
env:
TAG: ${{ inputs.tag }}
run: echo "version=${TAG}" >> "$GITHUB_OUTPUT"
- name: Download release checksums
run: |
VERSION="${{ steps.version.outputs.version }}"
curl -fsSL "https://github.com/floci-io/floci-cli/releases/download/${VERSION}/sha256sums.txt" \
-o sha256sums.txt
cat sha256sums.txt
- name: Extract per-platform SHA256
id: sha
run: |
echo "darwin_arm64=$(grep 'floci-darwin-arm64' sha256sums.txt | awk '{print $1}')" >> "$GITHUB_OUTPUT"
echo "darwin_amd64=$(grep 'floci-darwin-amd64' sha256sums.txt | awk '{print $1}')" >> "$GITHUB_OUTPUT"
echo "linux_amd64=$(grep 'floci-linux-amd64' sha256sums.txt | awk '{print $1}')" >> "$GITHUB_OUTPUT"
echo "linux_arm64=$(grep 'floci-linux-arm64' sha256sums.txt | awk '{print $1}')" >> "$GITHUB_OUTPUT"
- name: Checkout homebrew tap
uses: actions/checkout@v4
with:
repository: floci-io/homebrew-floci
token: ${{ secrets.GH_TOKEN }}
path: homebrew-floci
- name: Update formula
run: |
VERSION="${{ steps.version.outputs.version }}"
FORMULA="homebrew-floci/Formula/floci.rb"
sed -i "s/version \".*\"/version \"${VERSION}\"/" "$FORMULA"
sed -i "s|releases/download/[^/]*/|releases/download/${VERSION}/|g" "$FORMULA"
sed -i "s/{{VERSION}}/${VERSION}/g" "$FORMULA"
sed -i "s/{{SHA256_DARWIN_ARM64}}/${{ steps.sha.outputs.darwin_arm64 }}/g" "$FORMULA"
sed -i "s/{{SHA256_DARWIN_AMD64}}/${{ steps.sha.outputs.darwin_amd64 }}/g" "$FORMULA"
sed -i "s/{{SHA256_LINUX_AMD64}}/${{ steps.sha.outputs.linux_amd64 }}/g" "$FORMULA"
sed -i "s/{{SHA256_LINUX_ARM64}}/${{ steps.sha.outputs.linux_arm64 }}/g" "$FORMULA"
sed -i "/darwin-arm64/ { n; s/sha256 \".*\"/sha256 \"${{ steps.sha.outputs.darwin_arm64 }}\"/ }" "$FORMULA"
sed -i "/darwin-amd64/ { n; s/sha256 \".*\"/sha256 \"${{ steps.sha.outputs.darwin_amd64 }}\"/ }" "$FORMULA"
sed -i "/linux-amd64/ { n; s/sha256 \".*\"/sha256 \"${{ steps.sha.outputs.linux_amd64 }}\"/ }" "$FORMULA"
sed -i "/linux-arm64/ { n; s/sha256 \".*\"/sha256 \"${{ steps.sha.outputs.linux_arm64 }}\"/ }" "$FORMULA"
- name: Open PR
uses: peter-evans/create-pull-request@v7
with:
token: ${{ secrets.GH_TOKEN }}
path: homebrew-floci
commit-message: "floci ${{ steps.version.outputs.version }}"
title: "floci ${{ steps.version.outputs.version }}"
body: "Automated bump from floci-cli release workflow."
branch: "bump-${{ steps.version.outputs.version }}"