diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 1b59e7c..6675817 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -27,6 +27,14 @@ jobs: steps: - name: Check out code uses: actions/checkout@v4 + + - name: Set default branch variable + run : | + if [[ $GITHUB_REF_NAME == 'main' ]]; then + echo "IS_MAIN_BRANCH=true" >> "$GITHUB_ENV" + else + echo "IS_MAIN_BRANCH=false" >> "$GITHUB_ENV" + fi - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 @@ -61,7 +69,7 @@ jobs: labels: ${{ steps.meta.outputs.labels }} cache-from: type=gha,scope=ubicloud-${{ matrix.runner }} cache-to: type=gha,mode=max,scope=ubicloud-${{ matrix.runner }} - outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest={{is_default_branch}},name-canonical={{is_default_branch}},push={{is_default_branch}} + outputs: type=image,name=${{ env.IMAGE_NAME }},push-by-digest=${{env.IS_MAIN_BRANCH}},name-canonical=${{env.IS_MAIN_BRANCH}},push=${{env.IS_MAIN_BRANCH}} provenance: false - name: Export digest