@@ -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}:jdk"
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,28 +783,46 @@ 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.is_master }}
790+ branch : ${{ steps.detect_branch.outputs.branch }}
778791 steps :
779792 - name : Checkout
780793 uses : actions/checkout@v4
781- with :
782- fetch-depth : 0 # Ensure full git history is fetched
783794 - name : Detect branch name
784795 id : detect_branch
796+ env :
797+ EVENT_BASE_REF : ${{ github.event.base_ref || 'master' }}
785798 run : |
786- BRANCH_NAME=$(git branch -r --contains "$GITHUB_SHA" | grep -v 'HEAD' | head -n 1 | sed -e 's/.*origin\///')
787- echo "branch_name=$BRANCH_NAME" >> "$GITHUB_OUTPUT"
799+ BRANCH=${EVENT_BASE_REF#refs/heads/}
800+ echo "Detected branch: $BRANCH"
801+
802+ IS_MASTER=false
803+ if [ "$BRANCH" == "master" ]; then
804+ IS_MASTER=true
805+ fi
806+ echo "Detected is_master: $IS_MASTER"
807+
808+ echo "branch=$BRANCH" >> "$GITHUB_OUTPUT"
809+ echo "is_master=$IS_MASTER" >> "$GITHUB_OUTPUT"
810+
811+ trigger-repo-sync :
812+ name : Trigger runtime repo
813+ runs-on : ubuntu-20.04
814+ needs : [docker-default, detect_branch]
815+ timeout-minutes : 15
816+ steps :
817+ - name : Checkout
818+ uses : actions/checkout@v4
788819 - name : Trigger runtime
789820 uses : actions/github-script@v6
790821 with :
791822 github-token : ${{ secrets.GH_TRIGGER_TOKEN }}
792823 script : |
793824 const tagName = process.env.GITHUB_REF.replace('refs/tags/', '');
794- const branchName = '${{ steps. detect_branch.outputs.branch_name }}';
825+ const branchName = '${{ needs[' detect_branch'] .outputs.branch }}';
795826
796827 await github.rest.actions.createWorkflowDispatch({
797828 owner: 'cubedevinc',
0 commit comments