Skip to content

Commit

Permalink
repo: Sync fixes/cleanups
Browse files Browse the repository at this point in the history
Signed-off-by: Ryan Northey <[email protected]>
  • Loading branch information
phlax committed Sep 16, 2024
1 parent e222771 commit 6fd68f1
Show file tree
Hide file tree
Showing 2 changed files with 39 additions and 3 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/envoy-sync.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,10 @@ jobs:
with:
ref: main
token: ${{ steps.appauth.outputs.token }}
path: envoy-website
path: archive

- run: |
envoy_version="$(awk '/"envoy"/ { in_block=1 } in_block && /"version"/ { gsub(/[",]/, "", $2); print $2; in_block=0 }' envoy-website/versions.bzl)"
envoy_version="$(awk '/"envoy"/ { in_block=1 } in_block && /"version"/ { gsub(/[",]/, "", $2); print $2; in_block=0 }' archive/versions.bzl)"
echo "envoy_version=${envoy_version}" >> "$GITHUB_OUTPUT"
id: current
name: Get current Envoy version
Expand Down Expand Up @@ -73,7 +73,7 @@ jobs:
- run: ./sync_envoy.sh
if: ${{ steps.state.outputs.should_update == 'true' }}
working-directory: envoy-website
working-directory: archive
env:
ENVOY_SRC_DIR: ../envoy
COMMITTER_NAME: "update-envoy[bot]"
Expand Down
36 changes: 36 additions & 0 deletions sync_envoy.sh
Original file line number Diff line number Diff line change
@@ -0,0 +1,36 @@
#!/bin/bash -e

set -o pipefail


ENVOY_SRC_DIR="${ENVOY_SRC_DIR:-../envoy}"
ENVOY_VERSION=$(git -C "$ENVOY_SRC_DIR" rev-parse HEAD)
UPDATED=

if [[ -n "$COMMITTER_NAME" ]]; then
git config --global user.name "$COMMITTER_NAME"
fi

if [[ -n "$COMMITTER_EMAIL" ]]; then
git config --global user.email "$COMMITTER_EMAIL"
fi

sync_envoy () {
echo "Syncing Envoy -> ${ENVOY_VERSION}"
bazel run //bazel:update envoy "${ENVOY_VERSION}"
if git diff --quiet --exit-code; then
echo "No Envoy changes"
else
git commit versions.bzl -m "Sync Envoy @${ENVOY_VERSION}"
git show
UPDATED=1
fi
}

sync_envoy

if [[ -n "$UPDATED" ]]; then
git push origin HEAD:main
else
echo "Nothing to push"
fi

0 comments on commit 6fd68f1

Please sign in to comment.