diff --git a/.github/workflows/docker_image_builder.yml b/.github/workflows/docker_image_builder.yml index 8fbb465602..4e986aea6e 100644 --- a/.github/workflows/docker_image_builder.yml +++ b/.github/workflows/docker_image_builder.yml @@ -81,17 +81,30 @@ jobs: echo "otobo_commit=${{ github.sha }}" ) >> $GITHUB_ENV - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - - name: 'check out the relevant OTOBO branch' uses: actions/checkout@v4 + - + # check whether an devel image must be built + uses: dorny/paths-filter@v3 + id: changes + with: + base: "${{ github.ref_name }}" # e.g rel-10_0 + filters: | + context: + - '${{ matrix.context }}/**' + + - + name: Set up Docker Buildx + if: steps.changes.outputs.context == 'true' + uses: docker/setup-buildx-action@v3 + - # Build the image but do not push it to Docker Hub yet. # Enable caching with Github Actions Cache, which is limited to 10 GB. # context: . indicates that the current checkout is used name: Build + if: steps.changes.outputs.context == 'true' uses: docker/build-push-action@v6 with: load: true @@ -113,13 +126,14 @@ jobs: # Show some files in the image just to check sanity. # otobo_first_time hasn't run yet, so /opt/otobo is still empty name: Info - if: ${{ matrix.dockerfile == 'otobo.web.dockerfile' }} + if: ${{ steps.changes.outputs.context == 'true' && matrix.dockerfile == 'otobo.web.dockerfile' }} run: | docker run --rm -w /opt/otobo_install/otobo_next --entrypoint /bin/bash $otobo_ref -c "more git-repo.txt git-branch.txt git-commit.txt RELEASE | cat" - # login to Docker Hub before pushing to Docker Hub name: Login to Docker Hub + if: steps.changes.outputs.context == 'true' uses: docker/login-action@v3 with: username: ${{ secrets.DOCKERHUB_USERNAME }} @@ -129,6 +143,7 @@ jobs: # finally upload to DockerHub # the built image is already available in the job name: Push to DockerHub + if: steps.changes.outputs.context == 'true' uses: docker/build-push-action@v6 with: push: true