From ba80e8de29f9e7810c93aec6af0146136a81ee9d Mon Sep 17 00:00:00 2001 From: Yurii Puchkov Date: Sat, 23 Dec 2023 20:21:04 -0700 Subject: [PATCH] fix(cicd): do not trigger build for non-main branches --- .github/workflows/build.yaml | 17 +++++++++-------- 1 file changed, 9 insertions(+), 8 deletions(-) diff --git a/.github/workflows/build.yaml b/.github/workflows/build.yaml index a795b09..6182ad6 100644 --- a/.github/workflows/build.yaml +++ b/.github/workflows/build.yaml @@ -23,6 +23,14 @@ jobs: uses: actions/checkout@v3 with: fetch-depth: 0 + + - name: Dockerfile lint + if: ${{ env.IMAGE_EXIST == 'false' }} + id: validate-dockerfile + shell: bash + run: | + docker run --rm -e HADOLINT_IGNORE=DL3007,DL3008,DL3018,DL4006,DL3013 -i hadolint/hadolint < Dockerfile + - name: Unit Tests shell: bash run: | @@ -33,16 +41,10 @@ jobs: build: runs-on: ubuntu-latest needs: unittests + if: github.ref == 'refs/heads/main' steps: - uses: actions/checkout@v3 - - name: Dockerfile lint - if: ${{ env.IMAGE_EXIST == 'false' }} - id: validate-dockerfile - shell: bash - run: | - docker run --rm -e HADOLINT_IGNORE=DL3007,DL3008,DL3018,DL4006,DL3013 -i hadolint/hadolint < Dockerfile - - name: Docker Build shell: bash run: | @@ -57,7 +59,6 @@ jobs: password: ${{ secrets.DOCKER_PASSWORD }} - name: Docker Push - if: github.ref == 'refs/heads/main' shell: bash run: | set -x