From 2ded8676f4e46784dfb3ee4b4f9261695f14d783 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 29 Dec 2024 13:13:44 +0100 Subject: [PATCH 1/3] Push to the remote registry only on the main branch --- .github/workflows/build.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 549df8c..1fed3f5 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -30,7 +30,7 @@ jobs: with: context: . target: deps - push: ${{ github.event_name != 'pull_request' }} + push: ${{ github.ref == 'refs/heads/main' }} tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:deps cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:deps cache-to: type=inline @@ -40,7 +40,7 @@ jobs: with: context: . target: builder - push: ${{ github.event_name != 'pull_request' }} + push: ${{ github.ref == 'refs/heads/main' }} tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:builder cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:builder cache-to: type=inline @@ -49,7 +49,7 @@ jobs: uses: docker/build-push-action@v6 with: context: . - push: ${{ github.event_name != 'pull_request' }} + push: ${{ github.ref == 'refs/heads/main' }} tags: ${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:latest cache-to: type=inline \ No newline at end of file From b3dc01bbb5fb6918d0765bfc501460bc382129d9 Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 29 Dec 2024 13:14:32 +0100 Subject: [PATCH 2/3] Build nginx image on all branches --- .github/workflows/build.yml | 2 -- 1 file changed, 2 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1fed3f5..e7c0c5d 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -1,8 +1,6 @@ name: Build Nginx-based docker image on: push: - branches: - - main concurrency: group: ${{ github.ref }} cancel-in-progress: true From 5dabecc9eda4dcaa8b3650f18307c8f9f983db9c Mon Sep 17 00:00:00 2001 From: Manuel Bustillo Date: Sun, 29 Dec 2024 13:16:46 +0100 Subject: [PATCH 3/3] Update job name to be consistent with other jobs --- .github/workflows/build.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index e7c0c5d..1e73a81 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -43,7 +43,7 @@ jobs: cache-from: type=registry,ref=${{ secrets.PRIVATE_REGISTRY_HOST }}/${{ env.GITHUB_REPOSITORY }}:builder cache-to: type=inline - - name: Build and push + - name: Build and push (final) uses: docker/build-push-action@v6 with: context: .