From e573691157c12d207dcac515978bb0e5e8c6abbb Mon Sep 17 00:00:00 2001 From: Stefan Dej Date: Tue, 11 Jun 2024 10:41:49 +0200 Subject: [PATCH] ci: update publish.yml workflow and also build the image in PRs without pushing it Signed-off-by: Stefan Dej --- .github/workflows/publish.yml | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 5af6769..a1b5201 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -8,6 +8,8 @@ name: Create and publish a Docker image on: push: branches: ['master'] + pull_request: + branches: ['master'] env: REGISTRY: ghcr.io @@ -22,10 +24,10 @@ jobs: steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Log in to the Container registry - uses: docker/login-action@v1 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -33,14 +35,15 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v3 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push Docker image - uses: docker/build-push-action@v2 + uses: docker/build-push-action@v5 with: - push: true + context: . + push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} build-args: |