From 27f821d64129ad7e167682a9372356766e34218b Mon Sep 17 00:00:00 2001 From: Stefano Torresi Date: Mon, 16 Dec 2024 11:35:25 +0100 Subject: [PATCH] update gha worklflow --- .github/workflows/main.yml | 18 ++++++++---------- 1 file changed, 8 insertions(+), 10 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 533e76e..bd73fe2 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -1,13 +1,11 @@ name: Build & push container image to GH packages on: push: - tags-ignore: - - "*" branches: - "main" + tags: + - "**" pull_request: - release: - types: [published] workflow_dispatch: env: @@ -17,17 +15,17 @@ env: jobs: build-and-push-image: runs-on: ubuntu-latest - if: github.ref == 'refs/heads/main' || github.event_name == 'release' permissions: contents: read packages: write steps: - name: Checkout repository - uses: actions/checkout@v2 + uses: actions/checkout@v4 - name: Log in to the Container registry - uses: docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9 + if: github.event_name != 'pull_request' + uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} @@ -35,14 +33,14 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38 + uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - name: Build and push Docker image - uses: docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc + uses: docker/build-push-action@v6 with: context: . - push: true + push: ${{ github.event_name != 'pull_request' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}