Skip to content

Create Buf Release

Create Buf Release #5

Workflow file for this run

name: Create Buf Release
on:
workflow_dispatch:
inputs:
version:
type: string
description: The version you intend to release (eg x.y.z)
env:
VERSION: ${{ github.event.inputs.version }}
jobs:
update-formula:
runs-on: ubuntu-latest
steps:
- name: Checkout tap
uses: actions/checkout@v4
with:
path: base
- name: Update formula
run: |
# Darwin arm64
curl -LO https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-Darwin-arm64
SHA256=$(shasum -a 256 buf-Darwin-arm64 | awk '{print $1}')
sed -i "s/version \".*\"/version \"$VERSION\"/" base/Formula/buf.rb
sed -i "s/sha256 \".*\"/sha256 \"$SHA256\"/" base/Formula/buf.rb
sed -i "s/\"darwin-arm64\" => \".*\"/\"darwin-arm64\" => \"$SHA256\"/" base/Formula/buf.rb
# Darwin x86_64
curl -LO https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-Darwin-x86_64
SHA256=$(shasum -a 256 buf-Darwin-x86_64 | awk '{print $1}')
sed -i "s/\"darwin-x86_64\" => \".*\"/\"darwin-x86_64\" => \"$SHA256\"/" base/Formula/buf.rb
# Linux arm64
curl -LO https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-Linux-aarch64
SHA256=$(shasum -a 256 buf-Linux-aarch64 | awk '{print $1}')
sed -i "s/\"linux-arm64\" => \".*\"/\"linux-arm64\" => \"$SHA256\"/" base/Formula/buf.rb
# Linux x86_64
curl -LO https://github.com/bufbuild/buf/releases/download/v${VERSION}/buf-Linux-x86_64
SHA256=$(shasum -a 256 buf-Linux-x86_64 | awk '{print $1}')
sed -i "s/\"linux-x86_64\" => \".*\"/\"linux-x86_64\" => \"$SHA256\"/" base/Formula/buf.rb
- name: Create PR
uses: peter-evans/create-pull-request@v7
with:
commit-message: Update buf to v${{ github.event.inputs.version }}
title: Update buf to v${{ github.event.inputs.version }}
body: |
Update buf to v${{ github.event.inputs.version }}
branch: update-buf-${{ github.event.inputs.version }}