| 1 |
name: Protobuf update |
| 2 |
|
| 3 |
on: |
| 4 |
pull_request: |
| 5 |
types: [labeled] |
| 6 |
|
| 7 |
permissions: {} |
| 8 |
|
| 9 |
jobs: |
| 10 |
my_job: |
| 11 |
name: Update protobuf dependency |
| 12 |
runs-on: ubuntu-latest |
| 13 |
if: github.event.label.name == 'protobuf' |
| 14 |
permissions: |
| 15 |
contents: write # required to push commit to PR branch |
| 16 |
|
| 17 |
steps: |
| 18 |
- name: Checkout code |
| 19 |
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 |
| 20 |
with: |
| 21 |
fetch-depth: 0 |
| 22 |
persist-credentials: true # zizmor: ignore[artipacked] |
| 23 |
|
| 24 |
- name: Update versions.mk with latest release version |
| 25 |
run: | |
| 26 |
export PROTOC_VERSION="$(awk -F'[:@]' '/FROM ghcr.io\/homebrew\/core\/protobuf/{print $2; exit}' protoc-builder/hack/Dockerfile.protobuf)" |
| 27 |
echo "Detected protobuf v${PROTOC_VERSION}... computing digest of artifact" |
| 28 |
|
| 29 |
export PROTOC_ZIP=$(mktemp) |
| 30 |
curl -fsSL --retry 3 -o ${PROTOC_ZIP} https://github.com/protocolbuffers/protobuf/releases/download/v${PROTOC_VERSION}/protoc-${PROTOC_VERSION}-linux-x86_64.zip |
| 31 |
export PROTOC_CHECKSUM="$(sha256sum ${PROTOC_ZIP} | awk '{print "sha256:"$1}')" |
| 32 |
|
| 33 |
sed -i 's/^\(DEFAULT_PROTOC_VERSION\s*=\s*\).*/\1'v${PROTOC_VERSION}'/' protoc-builder/versions.mk |
| 34 |
sed -i 's/^\(DEFAULT_PROTOC_CHECKSUM\s*=\s*\).*/\1'${PROTOC_CHECKSUM}'/' protoc-builder/versions.mk |
| 35 |
|
| 36 |
- name: Amend Dependabot PR |
| 37 |
env: |
| 38 |
PULL_REQUEST_HEAD_REF: ${{ github.event.pull_request.head.ref }} |
| 39 |
run: | |
| 40 |
git config user.name "github-actions[bot]" |
| 41 |
git config user.email "41898282+github-actions[bot]@users.noreply.github.com" |
| 42 |
git add -A |
| 43 |
git commit -sam "Bumping default protoc version and checksum in versions.mk" |
| 44 |
git push origin HEAD:${PULL_REQUEST_HEAD_REF} |