From 086f66599af769a877ad98c87f61cd5f7410fbf4 Mon Sep 17 00:00:00 2001 From: Guido Petri <18634426+guidopetri@users.noreply.github.com> Date: Sat, 7 Oct 2023 12:15:37 -0500 Subject: [PATCH] build and push image only on master branch --- .github/workflows/ci.yml | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 14167d0d39..f1096b59d8 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -159,9 +159,18 @@ jobs: - name: Skip? id: skip-check run: | - if [[ "${{ vars.DOCKER_USER }}" == '' ]] || [[ "${{ secrets.DOCKER_PASS }}" == '' ]]; then + if [[ "${{ vars.DOCKER_USER }}" == '' ]]; then + echo 'Docker user is empty. Skipping build+push' + echo skip=true >> "$GITHUB_OUTPUT" + elif [[ "${{ secrets.DOCKER_PASS }}" == '' ]]; then + echo 'Docker password is empty. Skipping build+push' + echo skip=true >> "$GITHUB_OUTPUT" + elif [[ "${{ github.ref_name }}" != 'master' ]]; then + echo 'Ref name is not `master`. Skipping build+push' echo skip=true >> "$GITHUB_OUTPUT" else + echo 'Docker user and password are set and branch is `master`.' + echo 'Building + pushing `preview` image.' echo skip=false >> "$GITHUB_OUTPUT" fi @@ -172,7 +181,7 @@ jobs: - frontend-unit-tests - frontend-e2e-tests - build-skip-check - if: ${{ needs.build-skip-check.outputs.skip }} == false + if: needs.build-skip-check.outputs.skip == 'false' steps: - uses: actions/checkout@v3 with: