Skip to content

Commit

Permalink
Add workflow for CLI releases (#160)
Browse files Browse the repository at this point in the history
This adds a manual workflow for the CLI release process
to update `bufbuild/buf` to the version being released.
  • Loading branch information
doriable authored Oct 31, 2024
1 parent 7419f40 commit e7408d4
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 0 deletions.
39 changes: 39 additions & 0 deletions .github/workflows/update-buf-version.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Update bufbuild/buf Version
on:
workflow_dispatch:
inputs:
version:
type: string
description: The version you intend to release (e.g. x.y.z)
required: true
permissions:
contents: write
pull-requests: write
env:
RELEASE_BUF_VERSION: ${{ github.event.inputs.version }}

jobs:
prepare:
runs-on: ubuntu-latest
steps:
- name: Validate input version
if: ${{ startsWith(github.event.inputs.version, 'v') }}
run: |
echo "error: version must not start with 'v'."
exit 1
- name: Checkout repository code
uses: actions/checkout@v4
with:
token: ${{ steps.app_token.outputs.token }}
- name: Update Buf Version
run: make updatebufversion
- name: Create PR
run: |
git config user.name "${{ github.actor }}"
git config user.email "${{ github.actor }}@users.noreply.github.com"
BRANCH="release/v${RELEASE_BUF_VERSION}"
git switch -C ${BRANCH}
git add make/go/dep_buf.mk
git commit -m "Update version to ${RELEASE_BUF_VERSION}"
git push --set-upstream origin --force ${BRANCH}
gh pr create --title "Update buf version to v${RELEASE_BUF_VERSION}" --body "Update buf version to newly released version, ${RELEASE_BUF_VERSION}."
5 changes: 5 additions & 0 deletions make/go/buf.mk
Original file line number Diff line number Diff line change
Expand Up @@ -62,3 +62,8 @@ bufbreaking: $(BUF)
postlint:: bufbreaking
endif
endif

.PHONY: updatebufversion
updatebufversion:
$(SED_I) -E "s/BUF_VERSION \?=.*/BUF_VERSION ?= ${RELEASE_BUF_VERSION}/" "make/go/dep_buf.mk"
$(SED_I) -E "s/\# https\:\/\/github.com\/bufbuild\/buf\/releases.*/\# https\:\/\/github.com\/bufbuild\/buf\/releases $(shell date "+%Y%m%d") checked $(shell date "+%Y%m%d")/" "make/go/dep_buf.mk"

0 comments on commit e7408d4

Please sign in to comment.