name: Homebrew Bump # Triggered after release.yml succeeds on a version tag. # 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_run: workflows: [Release] types: [completed] permissions: contents: read jobs: bump: name: Bump Homebrew formula runs-on: ubuntu-latest if: ${{ github.event.workflow_run.conclusion == 'success' }} timeout-minutes: 10 steps: - name: Extract version from tag id: version run: | TAG="${{ github.event.workflow_run.head_branch }}" 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 }}"