2424 with :
2525 fetch-depth : 0
2626 submodules : true
27+ persist-credentials : false
2728
2829 - name : Setup Python
2930 uses : actions/setup-python@v5
@@ -37,32 +38,41 @@ jobs:
3738
3839 - name : Determine target protobufs version
3940 id : version
41+ env :
42+ INPUT_VERSION : ${{ github.event.inputs.version }}
43+ PAYLOAD_VERSION : ${{ github.event.client_payload.version }}
4044 run : |
4145 cd protobufs
4246 git fetch --tags
4347
44- if [ -n "${{ github.event.inputs.version } }" ]; then
45- target="${{ github.event.inputs.version } }"
46- elif [ -n "${{ github.event.client_payload.version } }" ]; then
47- target="${{ github.event.client_payload.version } }"
48+ if [ -n "${INPUT_VERSION }" ]; then
49+ target="${INPUT_VERSION }"
50+ elif [ -n "${PAYLOAD_VERSION }" ]; then
51+ target="${PAYLOAD_VERSION }"
4852 else
49- target=$(git describe --tags --abbrev=0)
53+ target=$(git tag --list 'v*' --sort=-version:refname | head -n1)
54+ if [ -z "${target}" ]; then
55+ echo "Error: no release tags found in meshtastic/protobufs"
56+ exit 1
57+ fi
5058 fi
5159
52- if ! git rev-parse --verify "refs/tags/${target}" >/dev/null 2>&1 ; then
60+ if ! git show-ref --verify --quiet "refs/tags/${target}"; then
5361 echo "Error: '${target}' is not a valid tag in meshtastic/protobufs"
5462 exit 1
5563 fi
5664
57- echo " version=${target}" >> "$GITHUB_OUTPUT"
65+ printf ' version=%s\n' " ${target}" >> "$GITHUB_OUTPUT"
5866 echo "Target protobufs version: ${target}"
5967
6068 - name : Update protobuf submodule to release
69+ env :
70+ TARGET_VERSION : ${{ steps.version.outputs.version }}
6171 run : |
6272 git submodule sync --recursive
6373 git submodule update --init --recursive
6474 cd protobufs
65- git checkout ${{ steps.version.outputs.version }}
75+ git checkout "${TARGET_VERSION}"
6676 cd ..
6777
6878 - name : Download nanopb
@@ -80,14 +90,16 @@ jobs:
8090 ./bin/regen-protobufs.sh
8191
8292 - name : Commit update
93+ env :
94+ TARGET_VERSION : ${{ steps.version.outputs.version }}
8395 run : |
8496 git config --global user.name 'github-actions'
8597 git config --global user.email 'bot@noreply.github.com'
8698 git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }}
8799 git add protobufs
88100 git add meshtastic/protobuf
89101 if [[ -n "$(git status --porcelain)" ]]; then
90- git commit -m "protobufs: ${{ steps.version.outputs.version } }"
102+ git commit -m "protobufs: ${TARGET_VERSION }"
91103 git push
92104 else
93105 echo "No changes to commit"
0 commit comments