Skip to content

Commit 77bfd43

Browse files
committed
chore(ci): Publish - ignore latest tag for docker builds on LTS branches
1 parent b7306d2 commit 77bfd43

File tree

1 file changed

+39
-11
lines changed

1 file changed

+39
-11
lines changed

.github/workflows/publish.yml

Lines changed: 39 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -305,7 +305,7 @@ jobs:
305305
overwrite: true
306306

307307
docker-default:
308-
needs: [npm, cubestore_linux, native_linux]
308+
needs: [npm, cubestore_linux, native_linux, detect_branch]
309309
name: Debian docker image
310310
runs-on: ${{ matrix.os }}
311311
strategy:
@@ -345,7 +345,11 @@ jobs:
345345
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
346346
MINOR=${VERSION%.*}
347347
MAJOR=${MINOR%.*}
348-
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR},${DOCKER_IMAGE}:latest"
348+
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR},${DOCKER_IMAGE}:${MAJOR}"
349+
fi
350+
351+
if [ "${{ needs['detect_branch'].outputs.is_master }}" = "true" ]; then
352+
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
349353
fi
350354
351355
{
@@ -385,7 +389,7 @@ jobs:
385389
IMAGE_VERSION=${{ steps.prep.outputs.version }}
386390
387391
docker-debian-jdk:
388-
needs: [npm, cubestore_linux, native_linux]
392+
needs: [npm, cubestore_linux, native_linux, detect_branch]
389393
name: Debian with jdk docker image
390394
runs-on: ubuntu-24.04
391395
timeout-minutes: 30
@@ -420,11 +424,15 @@ jobs:
420424
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
421425
MINOR=${VERSION%.*}
422426
MAJOR=${MINOR%.*}
423-
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR}-jdk,${DOCKER_IMAGE}:${MAJOR}-jdk,${DOCKER_IMAGE}:jdk"
427+
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR}-jdk,${DOCKER_IMAGE}:${MAJOR}-jdk"
424428
elif [ "${{ github.event_name }}" = "push" ]; then
425429
TAGS="$TAGS,${DOCKER_IMAGE}:sha-${GITHUB_SHA::8}-jdk"
426430
fi
427431
432+
if [ "${{ needs['detect_branch'].outputs.is_master }}" = "true" ]; then
433+
TAGS="$TAGS,${DOCKER_IMAGE}:latest"
434+
fi
435+
428436
{
429437
echo "version=${VERSION}"
430438
echo "tags=${TAGS}"
@@ -464,6 +472,7 @@ jobs:
464472
docker-cubestore:
465473
name: Cube Store Docker
466474
runs-on: ${{ matrix.os }}
475+
needs: [detect_branch]
467476
strategy:
468477
fail-fast: false
469478
matrix:
@@ -521,7 +530,11 @@ jobs:
521530
if [[ $VERSION =~ ^v[0-9]{1,3}\.[0-9]{1,3}\.[0-9]{1,3}$ ]]; then
522531
MINOR=${VERSION%.*}
523532
MAJOR=${MINOR%.*}
524-
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR}${{ matrix.postfix }},${DOCKER_IMAGE}:${MAJOR}${{ matrix.postfix }},${DOCKER_IMAGE}:${{ matrix.tag }}"
533+
TAGS="$TAGS,${DOCKER_IMAGE}:${MINOR}${{ matrix.postfix }},${DOCKER_IMAGE}:${MAJOR}${{ matrix.postfix }}"
534+
fi
535+
536+
if [ "${{ needs['detect_branch'].outputs.is_master }}" = "true" ]; then
537+
TAGS="$TAGS,${DOCKER_IMAGE}:${{ matrix.tag }}"
525538
fi
526539
527540
{
@@ -770,11 +783,11 @@ jobs:
770783
}
771784
})
772785
773-
trigger-repo-sync:
774-
name: Trigger runtime repo
786+
detect_branch:
775787
runs-on: ubuntu-20.04
776-
needs: [docker-default]
777-
timeout-minutes: 15
788+
outputs:
789+
is_master: ${{ steps.detect_branch.outputs.sha }}
790+
branch: ${{ steps.detect_branch.outputs.sha }}
778791
steps:
779792
- name: Checkout
780793
uses: actions/checkout@v4
@@ -785,13 +798,28 @@ jobs:
785798
run: |
786799
BRANCH_NAME=$(git branch -r --contains "$GITHUB_SHA" | grep -v 'HEAD' | head -n 1 | sed -e 's/.*origin\///')
787800
echo "branch_name=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
801+
802+
if [ "$BRANCH_NAME" == "master" ]; then
803+
echo "is_master=true" >> "$GITHUB_OUTPUT"
804+
else
805+
echo "is_master=false" >> "$GITHUB_OUTPUT"
806+
fi
807+
808+
trigger-repo-sync:
809+
name: Trigger runtime repo
810+
runs-on: ubuntu-20.04
811+
needs: [docker-default, detect_branch]
812+
timeout-minutes: 15
813+
steps:
814+
- name: Checkout
815+
uses: actions/checkout@v4
788816
- name: Trigger runtime
789817
uses: actions/github-script@v6
790818
with:
791819
github-token: ${{ secrets.GH_TRIGGER_TOKEN }}
792820
script: |
793821
const tagName = process.env.GITHUB_REF.replace('refs/tags/', '');
794-
const branchName = '${{ steps.detect_branch.outputs.branch_name }}';
822+
const branchName = '${{ needs['detect_branch'].outputs.branch }}';
795823
796824
await github.rest.actions.createWorkflowDispatch({
797825
owner: 'cubedevinc',
@@ -800,6 +828,6 @@ jobs:
800828
ref: 'master',
801829
inputs: {
802830
'tag': tagName,
803-
'branch': branchName,
831+
'branch':branchName,
804832
}
805833
})

0 commit comments

Comments
 (0)