diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index dc240e62..18ddf400 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,6 +19,31 @@ jobs: with: arch: ${{ matrix.arch }} + paths-filter: + runs-on: ubuntu-latest + outputs: + docker_needs_build: ${{ steps.filter.outputs.docker == 'true' }} + steps: + - uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4.1.1 + - uses: dorny/paths-filter@4512585405083f25c027a35db413c2b3b9006d50 # v2.11.1 + id: filter + with: + filters: | + docker: + - 'docker/**' + + build-images-dev: + needs: [build-test-dev,paths-filter] + if: needs.paths-filter.outputs.docker_needs_build + strategy: + matrix: + arch: [ amd64, arm64 ] + uses: ./.github/workflows/reusable_build_push_images.yml + with: + arch: ${{ matrix.arch }} + push: false + secrets: inherit + gomodtidy: name: Enforce go.mod tidiness runs-on: ubuntu-latest diff --git a/.github/workflows/master.yml b/.github/workflows/master.yml index 44dd8b92..2797de4a 100644 --- a/.github/workflows/master.yml +++ b/.github/workflows/master.yml @@ -18,18 +18,19 @@ jobs: arch: ${{ matrix.arch }} push-images-master: + needs: build-test-master strategy: matrix: arch: [amd64, arm64] uses: ./.github/workflows/reusable_build_push_images.yml - needs: build-test-master with: arch: ${{ matrix.arch }} + push: true secrets: inherit images-master: - uses: ./.github/workflows/reusable_manifest_images.yml needs: push-images-master + uses: ./.github/workflows/reusable_manifest_images.yml secrets: inherit diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 6d600da6..faaf3fc0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -19,20 +19,21 @@ jobs: arch: ${{ matrix.arch }} push-images-release: + needs: build-test-release strategy: matrix: arch: [amd64, arm64] uses: ./.github/workflows/reusable_build_push_images.yml - needs: build-test-release with: arch: ${{ matrix.arch }} tag: ${{ github.ref_name }} is_latest: true + push: true secrets: inherit images-release: - uses: ./.github/workflows/reusable_manifest_images.yml needs: push-images-release + uses: ./.github/workflows/reusable_manifest_images.yml with: tag: ${{ github.ref_name }} is_latest: true diff --git a/.github/workflows/reusable_build_push_images.yml b/.github/workflows/reusable_build_push_images.yml index 5662e87e..2f00a8e9 100644 --- a/.github/workflows/reusable_build_push_images.yml +++ b/.github/workflows/reusable_build_push_images.yml @@ -21,6 +21,11 @@ on: required: false type: boolean default: false + push: + description: Whether to also push images + required: false + type: boolean + default: false jobs: build-images: @@ -48,14 +53,20 @@ jobs: uses: docker/setup-buildx-action@f95db51fddba0c2d1ec667646a06c2ce06100226 # v3.0.0 - name: Login to Docker Hub + if: inputs.push uses: docker/login-action@343f7c4344506bcbf9b4de18042ae17996df046d # v3.0.0 with: username: ${{ secrets.DOCKERHUB_USER }} password: ${{ secrets.DOCKERHUB_SECRET }} - name: Build and Push docker images + if: inputs.push run: make push/all - + + - name: Build docker images + if: inputs.push == false + run: make build/all + - name: Push latest images if needed - if: inputs.is_latest + if: inputs.push && inputs.is_latest run: make push/latest