Improve update_protobufs workflow to use release versions, put version in commit, and allow specifying a version, as well as allowing dispatch from other repositories.

This commit is contained in:
Ian McEwen committed 2026-08-11 11:32:44 -07:00
1 parent ae710478fb
commit e45e59ad39
1 file changed
+38 -4
+38 -4
View File
@@ -1,5 +1,15 @@
name: "Update protobufs"
on: workflow_dispatch
on:
workflow_dispatch:
inputs:
version:
description: "Protobufs version tag to sync to (e.g., v2.7.26). Defaults to the latest protobufs release."
required: false
default: ""
type: string
repository_dispatch:
types: [protobufs-release]
permissions:
contents: write
@@ -25,11 +35,35 @@ jobs:
python -m pip install --upgrade pip
python -m pip install poetry
- name: Update protobuf submodule
- name: Determine target protobufs version
id: version
run: |
cd protobufs
git fetch --tags
if [ -n "${{ github.event.inputs.version }}" ]; then
target="${{ github.event.inputs.version }}"
elif [ -n "${{ github.event.client_payload.version }}" ]; then
target="${{ github.event.client_payload.version }}"
else
target=$(git describe --tags --abbrev=0)
fi
if ! git rev-parse --verify "refs/tags/${target}" >/dev/null 2>&1; then
echo "Error: '${target}' is not a valid tag in meshtastic/protobufs"
exit 1
fi
echo "version=${target}" >> "$GITHUB_OUTPUT"
echo "Target protobufs version: ${target}"
- name: Update protobuf submodule to release
run: |
git submodule sync --recursive
git submodule update --init --recursive
git submodule update --remote --recursive
cd protobufs
git checkout ${{ steps.version.outputs.version }}
cd ..
- name: Download nanopb
run: |
@@ -53,7 +87,7 @@ jobs:
git add protobufs
git add meshtastic/protobuf
if [[ -n "$(git status --porcelain)" ]]; then
git commit -m "Update protobufs"
git commit -m "protobufs: ${{ steps.version.outputs.version }}"
git push
else
echo "No changes to commit"