api_update #10
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Called update for API change | |
on: | |
repository_dispatch: | |
types: [api_update] | |
jobs: | |
test: | |
name: "Create PR for API update" | |
timeout-minutes: 10 | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- uses: actions/setup-node@v4 | |
- name: "Update Buf Script" | |
id: buf-update | |
uses: authzed/actions/buf-api-update@main | |
with: | |
api-commit: ${{ github.event.client_payload.BUFTAG }} | |
spec-path: buf.gen.yaml | |
file-format: generate-shell-script | |
- name: "Output update status" | |
env: | |
UPDATED_STATUS: ${{ steps.buf-update.outputs.updated }} | |
run: | | |
echo "Update status: $UPDATED_STATUS" | |
- name: "Update package version" | |
uses: authzed/actions/semver-update@main | |
if: steps.buf-update.outputs.updated == 'true' | |
with: | |
sourcefile-path: package.json | |
version-regex: '"version": "(.+)"' | |
version-change: minor | |
- name: "Update js-dist package version" | |
uses: authzed/actions/semver-update@main | |
if: steps.buf-update.outputs.updated == 'true' | |
with: | |
sourcefile-path: js-dist/package.json | |
version-regex: '"version": "(.+)"' | |
version-change: minor | |
- name: "Install NPM deps" | |
uses: bahmutov/npm-install@v1 | |
if: steps.buf-update.outputs.updated == 'true' | |
with: | |
useLockFile: false | |
working-directory: ./ | |
- name: "Install buf" | |
uses: "bufbuild/[email protected]" | |
if: steps.buf-update.outputs.updated == 'true' | |
with: | |
version: "1.37.0" | |
- name: "Run buf generate" | |
if: steps.buf-update.outputs.updated == 'true' | |
run: | | |
./buf.gen.yaml | |
- name: Create Pull Request | |
uses: peter-evans/[email protected] | |
if: steps.buf-update.outputs.updated == 'true' | |
with: | |
delete-branch: "true" | |
title: Update API to ${{ github.event.client_payload.BUFTAG }} | |
branch: api-change/${{ github.event.client_payload.BUFTAG }} | |
token: ${{ secrets.GITHUB_TOKEN }} |