Skip to content

Commit

Permalink
Use standard rebuild approach
Browse files Browse the repository at this point in the history
  • Loading branch information
tstirrat15 committed Nov 4, 2024
1 parent 6a1f9b0 commit 030eb3f
Show file tree
Hide file tree
Showing 2 changed files with 18 additions and 57 deletions.
42 changes: 11 additions & 31 deletions .github/workflows/automatic-api-update.yaml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
name: Called update for API change
name: "Called update for API change"
on:
repository_dispatch:
types: [api_update]
types: ["api_update"]
jobs:
test:
name: "Create PR for API update"
Expand All @@ -14,48 +14,28 @@ jobs:
id: buf-update
uses: authzed/actions/buf-api-update@main
with:
api-commit: ${{ github.event.client_payload.BUFTAG }}
api-commit: "${{ github.event.client_payload.BUFTAG }}"
spec-path: buf.gen.yaml
file-format: generate-shell-script
file-format: "buf-gen-yaml"
- 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/buf-setup-action@v1.46.0"
if: steps.buf-update.outputs.updated == 'true'
uses: "bufbuild/buf-setup-action@v1.43.0"
with:
version: "1.37.0"
github_token: ${{ secrets.GITHUB_TOKEN }}
if: steps.buf-update.outputs.updated == 'true'
- name: "Run buf generate"
if: steps.buf-update.outputs.updated == 'true'
run: |
./buf.gen.yaml
run: "buf generate"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7.0.5
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 }}
title: "Update API to ${{ github.event.client_payload.BUFTAG }}"
branch: "api-change/${{ github.event.client_payload.BUFTAG }}"
base: "main"
token: ${{ secrets.GITHUB_TOKEN }}
33 changes: 7 additions & 26 deletions .github/workflows/manual-api-update.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
---
name: Update for API change
on:
workflow_dispatch:
Expand All @@ -20,46 +21,26 @@ jobs:
with:
api-commit: ${{ inputs.buftag }}
spec-path: buf.gen.yaml
file-format: generate-shell-script
file-format: "buf-gen-yaml"
- 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/buf-setup-action@v1.46.0"
if: steps.buf-update.outputs.updated == 'true'
uses: "bufbuild/buf-setup-action@v1.43.0"
with:
version: "1.37.0"
github_token: ${{ secrets.GITHUB_TOKEN }}
if: steps.buf-update.outputs.updated == 'true'
- name: "Run buf generate"
if: steps.buf-update.outputs.updated == 'true'
run: |
./buf.gen.yaml
run: "buf generate"
- name: Create Pull Request
uses: peter-evans/create-pull-request@v7.0.5
if: steps.buf-update.outputs.updated == 'true'
with:
delete-branch: "true"
title: Update API to ${{ inputs.buftag }}
branch: api-change/${{ inputs.buftag }}
base: "main"
token: ${{ secrets.GITHUB_TOKEN }}

0 comments on commit 030eb3f

Please sign in to comment.