From 212550c5a9e6f5a79a77864eaf6b30dc07d4f6b4 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Wenkai=20Yin=28=E5=B0=B9=E6=96=87=E5=BC=80=29?= Date: Mon, 21 Feb 2022 11:15:33 +0800 Subject: [PATCH] Enable building and pushing image for release branches MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Enable building and pushing image for release branches Signed-off-by: Wenkai Yin(尹文开) --- .github/workflows/push.yml | 4 +++- hack/docker-push.sh | 15 +++++++-------- 2 files changed, 10 insertions(+), 9 deletions(-) diff --git a/.github/workflows/push.yml b/.github/workflows/push.yml index 4d232ef9d..9bcf750f4 100644 --- a/.github/workflows/push.yml +++ b/.github/workflows/push.yml @@ -2,7 +2,9 @@ name: Main CI on: push: - branches: [ main ] + branches: + - 'main' + - 'release-**' tags: - '*' diff --git a/hack/docker-push.sh b/hack/docker-push.sh index cf3a0c5f8..9b6c4ed18 100755 --- a/hack/docker-push.sh +++ b/hack/docker-push.sh @@ -56,9 +56,8 @@ elif [[ "$triggeredBy" == "tags" ]]; then TAG=$(echo $GITHUB_REF | cut -d / -f 3) fi -if [[ "$BRANCH" == "main" ]]; then - VERSION="$BRANCH" -elif [[ ! -z "$TAG" ]]; then +if [[ ! -z "$TAG" ]]; then + echo "We're building tag $TAG" # Explicitly checkout tags when building from a git tag. # This is not needed when building from main git fetch --tags @@ -66,16 +65,16 @@ elif [[ ! -z "$TAG" ]]; then highest_release VERSION="$TAG" else - echo "We're not on main and we're not building a tag, exit early." - exit 0 + echo "We're on branch $BRANCH" + VERSION="$BRANCH" fi # Assume we're not tagging `latest` by default, and never on main. TAG_LATEST=false -if [[ "$BRANCH" == "main" ]]; then - echo "Building main, not tagging latest." -elif [[ "$TAG" == "$HIGHEST" ]]; then +if [[ "$TAG" == "$HIGHEST" ]]; then TAG_LATEST=true +else + echo "Building $BRANCH, not tagging latest" fi if [[ -z "$BUILDX_PLATFORMS" ]]; then