Update protobufs #30
This file contains hidden or 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: "Update protobufs" | |
| on: workflow_dispatch | |
| permissions: | |
| contents: write | |
| jobs: | |
| update-protobufs: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| submodules: true | |
| - name: Setup Python | |
| uses: actions/setup-python@v5 | |
| with: | |
| python-version: "3.12" | |
| - name: Install Poetry | |
| run: | | |
| python -m pip install --upgrade pip | |
| python -m pip install poetry | |
| - name: Update protobuf submodule | |
| run: | | |
| git submodule sync --recursive | |
| git submodule update --init --recursive | |
| git submodule update --remote --recursive | |
| - name: Download nanopb | |
| run: | | |
| curl -L -o nanopb-0.4.8-linux-x86.tar.gz https://jpa.kapsi.fi/nanopb/download/nanopb-0.4.8-linux-x86.tar.gz | |
| tar xvzf nanopb-0.4.8-linux-x86.tar.gz | |
| mv nanopb-0.4.8-linux-x86 nanopb-0.4.8 | |
| - name: Install Python dependencies | |
| run: | | |
| poetry install --with dev | |
| - name: Re-generate protocol buffers | |
| run: | | |
| ./bin/regen-protobufs.sh | |
| - name: Commit update | |
| run: | | |
| git config --global user.name 'github-actions' | |
| git config --global user.email 'bot@noreply.github.com' | |
| git remote set-url origin https://x-access-token:${{ secrets.GITHUB_TOKEN }}@github.com/${{ github.repository }} | |
| git add protobufs | |
| git add meshtastic/protobuf | |
| if [[ -n "$(git status --porcelain)" ]]; then | |
| git commit -m "Update protobufs" | |
| git push | |
| else | |
| echo "No changes to commit" | |
| fi |