From 3274fb1e2b94bbddb97ebdde5a324c44c5a34650 Mon Sep 17 00:00:00 2001 From: Antti Viitala Date: Mon, 8 Jan 2024 18:00:44 +0800 Subject: [PATCH 1/2] ci: build container without pushing on PRs against main --- .github/workflows/build-container.yaml | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/.github/workflows/build-container.yaml b/.github/workflows/build-container.yaml index 9c1d980..3414221 100644 --- a/.github/workflows/build-container.yaml +++ b/.github/workflows/build-container.yaml @@ -8,6 +8,9 @@ on: push: branches: - "main" + pull_request: + branches: + - "main" workflow_dispatch: permissions: @@ -39,7 +42,7 @@ jobs: with: context: ./. file: ./Dockerfile - push: true + push: ${{ github.event_name != 'pull_request' }} tags: ${{env.REGISTRY}}:${{github.run_number}}, ${{env.REGISTRY}}:latest cache-from: type=gha cache-to: type=gha,mode=max From 1d0e37ef8afd8c7785d36f7a84245477dc99b493 Mon Sep 17 00:00:00 2001 From: Antti Viitala Date: Mon, 8 Jan 2024 18:04:20 +0800 Subject: [PATCH 2/2] ci: update build step name --- .github/workflows/build-container.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-container.yaml b/.github/workflows/build-container.yaml index 3414221..d188b78 100644 --- a/.github/workflows/build-container.yaml +++ b/.github/workflows/build-container.yaml @@ -36,7 +36,7 @@ jobs: - name: Set REGISTRY env variable run: echo "REGISTRY=ghcr.io/$(echo ${{ github.repository }} | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV - - name: Build and push + - name: Build container image uses: docker/build-push-action@v4 id: build-image with: