From 54f62c64413d4af8de51e1e1e468287b2443019b Mon Sep 17 00:00:00 2001 From: Nat Welch Date: Thu, 19 Sep 2024 14:38:47 +0000 Subject: [PATCH] chore: adjust docker --- .github/workflows/docker.yml | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/.github/workflows/docker.yml b/.github/workflows/docker.yml index 97f8320..c6ed665 100644 --- a/.github/workflows/docker.yml +++ b/.github/workflows/docker.yml @@ -3,6 +3,7 @@ on: push: branches: - main + pull_request: env: REGISTRY: ghcr.io IMAGE_NAME: ${{ github.repository }} @@ -18,24 +19,24 @@ jobs: - name: Checkout repository uses: actions/checkout@v4 - name: Log in to the Container registry - uses: docker/login-action@9780b0c442fbb1117ed29e0efdff1e18412f7567 + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@60a0d343a0d8a18aedee9d34e62251f752153bdb + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push Docker image id: push - uses: docker/build-push-action@5176d81f87c23d6fc96624dfdbcd9f3830bbe445 + uses: docker/build-push-action@v6 env: GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} with: context: . - push: true + push: ${{ github.ref == 'refs/heads/main' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} - name: Generate artifact attestation @@ -43,4 +44,4 @@ jobs: with: subject-name: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}} subject-digest: ${{ steps.push.outputs.digest }} - push-to-registry: true + push-to-registry: ${{ github.ref == 'refs/heads/main' }}