Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

repo: Sync fixes/cleanups #21

Merged
merged 1 commit into from
Sep 16, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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