From 26bf66b9035143ced7b11bcbf474228d44a2908e Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 14 Oct 2023 11:39:18 +0200 Subject: [PATCH 1/3] github: limit container push action Only push the container to ghcr in case the repository is owned by the freifunk-gluon organization. THis avoids failing CI on forks. Signed-off-by: David Bauer --- .github/workflows/build-container.yml | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index a8cd3d981d..e252c4ee29 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -21,6 +21,7 @@ jobs: uses: actions/checkout@v4 - name: Log in to the Container registry uses: docker/login-action@b4bedf8053341df3b5a9f9e0f2cf4e79e27360c6 + if: ${{ github.repository_owner == 'freifunk-gluon' }} with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -34,6 +35,6 @@ jobs: uses: docker/build-push-action@4c1b68d83ad20cc1a09620ca477d5bbbb5fa14d0 with: context: ./contrib/docker - push: true + push: ${{ github.repository_owner == 'freifunk-gluon' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} From 737671e296d5f32428b5b76313314fe970342221 Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 14 Oct 2023 12:33:42 +0200 Subject: [PATCH 2/3] github: build on release-branches --- .github/workflows/build-container.yml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index e252c4ee29..4a61ecb1b6 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -5,6 +5,7 @@ on: push: branches: - 'master' + - 'v202[0-9].[0-9].x' tags: - 'v*' From 7ea311f0371539706ef6e5d82f52d6fe0281edfa Mon Sep 17 00:00:00 2001 From: David Bauer Date: Sat, 14 Oct 2023 12:37:24 +0200 Subject: [PATCH 3/3] github: build docker-container on pull-request Also build the docker-container whan creating pull-requests. Keep the pull-request triggered builds from pushing to the container registry. Signed-off-by: David Bauer --- .github/workflows/build-container.yml | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/.github/workflows/build-container.yml b/.github/workflows/build-container.yml index 4a61ecb1b6..b8ed6e4905 100644 --- a/.github/workflows/build-container.yml +++ b/.github/workflows/build-container.yml @@ -8,6 +8,7 @@ on: - 'v202[0-9].[0-9].x' tags: - 'v*' + pull_request: env: REGISTRY: ghcr.io @@ -22,7 +23,7 @@ jobs: uses: actions/checkout@v4 - name: Log in to the Container registry uses: docker/login-action@b4bedf8053341df3b5a9f9e0f2cf4e79e27360c6 - if: ${{ github.repository_owner == 'freifunk-gluon' }} + if: ${{ github.repository_owner == 'freifunk-gluon' && github.event_name == 'push' }} with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -36,6 +37,6 @@ jobs: uses: docker/build-push-action@4c1b68d83ad20cc1a09620ca477d5bbbb5fa14d0 with: context: ./contrib/docker - push: ${{ github.repository_owner == 'freifunk-gluon' }} + push: ${{ github.repository_owner == 'freifunk-gluon' && github.event_name == 'push' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}