Skip to content

Commit 6bddd21

Browse files
authored
Add a update protos github action (#34)
1 parent e83ea3f commit 6bddd21

File tree

3 files changed

+642
-0
lines changed

3 files changed

+642
-0
lines changed
Lines changed: 65 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
name: Update Protos and Create PR
2+
3+
on:
4+
workflow_dispatch:
5+
inputs:
6+
release_version:
7+
description: 'Cloud API release version to update to (e.g., v1.2.3).'
8+
required: true
9+
type: string
10+
sdk_version:
11+
description: 'SDK version to set (e.g., 0.7.0). Use the version that is intended for the next release.'
12+
required: true
13+
type: string
14+
branch_name:
15+
description: 'Branch name for the PR (default: auto-generated)'
16+
required: false
17+
default: ''
18+
type: string
19+
pr_title:
20+
description: 'PR title (default: auto-generated)'
21+
required: false
22+
default: ''
23+
type: string
24+
25+
jobs:
26+
update-protos:
27+
name: Update Protos and Create PR
28+
runs-on: ubuntu-latest
29+
permissions:
30+
contents: write
31+
pull-requests: write
32+
steps:
33+
- name: Checkout repository
34+
uses: actions/checkout@v4
35+
with:
36+
token: ${{ secrets.GITHUB_TOKEN }}
37+
submodules: 'true'
38+
fetch-depth: 0
39+
40+
- name: Setup Go
41+
uses: actions/setup-go@v5
42+
with:
43+
go-version: 'stable'
44+
45+
- name: Install GitHub CLI
46+
run: |
47+
curl -fsSL https://cli.github.com/packages/githubcli-archive-keyring.gpg | sudo dd of=/usr/share/keyrings/githubcli-archive-keyring.gpg
48+
echo "deb [arch=$(dpkg --print-architecture) signed-by=/usr/share/keyrings/githubcli-archive-keyring.gpg] https://cli.github.com/packages stable main" | sudo tee /etc/apt/sources.list.d/github-cli.list > /dev/null
49+
sudo apt update
50+
sudo apt install gh -y
51+
52+
- name: Update protos using script
53+
run: |
54+
# Set environment variables for the script
55+
export GITHUB_TOKEN="${{ secrets.GITHUB_TOKEN }}"
56+
export GITHUB_REPOSITORY="${{ github.repository }}"
57+
export GITHUB_ACTIONS="true"
58+
59+
# Run the update script
60+
./scripts/update-protos.sh \
61+
--release-version "${{ github.event.inputs.release_version }}" \
62+
--sdk-version "${{ github.event.inputs.sdk_version }}" \
63+
--branch-name "${{ github.event.inputs.branch_name }}" \
64+
--pr-title "${{ github.event.inputs.pr_title }}" \
65+
--verbose

CONTRIBUTING.md

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,27 @@ To get the latest protos, run the following commands:
4343
git submodule update --recursive --remote --merge
4444
```
4545

46+
### Automated Proto Updates
47+
For convenience, there's a GitHub Action workflow that can automatically update the protos and create a PR. This workflow:
48+
49+
1. Updates the proto submodule to get the latest changes or a specific release
50+
2. Regenerates all Go code from the proto files
51+
3. Updates the default API version in `cloudclient/options.go`
52+
4. Increments the patch version of the SDK version in `cloudclient/options.go`
53+
5. Creates a new branch and commits the changes
54+
6. Opens a pull request with the updates
55+
56+
To use this workflow:
57+
1. Go to the "Actions" tab in the GitHub repository
58+
2. Select "Update Protos and Create PR" from the workflow list
59+
3. Click "Run workflow"
60+
4. Provide the following optional inputs:
61+
- **Release version**: Specify a cloud-api release version (e.g., `v1.2.3`) to checkout that specific release. Leave empty to get the latest.
62+
- **Branch name**: Custom branch name for the PR (default: auto-generated)
63+
- **PR title**: Custom PR title (default: auto-generated)
64+
5. Click "Run workflow" to execute
65+
66+
The workflow will automatically handle all the steps from the manual process above and create a PR for review.
4667

4768
## Testing
4869

0 commit comments

Comments
 (0)