From ee08f44d7103b1aaa3cd1682bfed7c0ccaf2c735 Mon Sep 17 00:00:00 2001 From: Valerio Date: Fri, 11 Oct 2024 15:55:33 +0200 Subject: [PATCH] chore: Docker image tag (#4) chore: docker image tag --- .github/workflows/pull-request.yml | 43 ------------------------------ .github/workflows/release.yml | 29 +++++++++++++++----- 2 files changed, 22 insertions(+), 50 deletions(-) delete mode 100644 .github/workflows/pull-request.yml diff --git a/.github/workflows/pull-request.yml b/.github/workflows/pull-request.yml deleted file mode 100644 index 49314b9..0000000 --- a/.github/workflows/pull-request.yml +++ /dev/null @@ -1,43 +0,0 @@ -name: pull-request - -on: - push: - branches: [main] - pull_request: - branches: [main] - # for future develpments - # tags: - # - v* - -permissions: - # To push Docker images to GitHub - packages: write - -jobs: - docker-build: - runs-on: ubuntu-latest - steps: - - name: Set up QEMU - uses: docker/setup-qemu-action@v3 - - - name: Set up Docker Buildx - uses: docker/setup-buildx-action@v3 - with: - platforms: linux/amd64 - - - name: Login to GitHub Container Registry - uses: docker/login-action@v3 - with: - registry: ghcr.io - username: ${{ github.repository_owner }} - password: ${{ secrets.GITHUB_TOKEN }} - - - name: Build and push - uses: docker/build-push-action@v6 - with: - file: "Dockerfile.app" - platforms: linux/amd64 - push: false - tags: | - ghcr.io/teamdigitale/dataviz-srv:latest - ghcr.io/teamdigitale/dataviz-srv:0.0.1 diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 74373dd..288d8ce 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -3,9 +3,10 @@ name: release on: push: branches: [main] - # for future develpments - # tags: - # - v* + tags: + - "v*" + pull_request: + branches: [main] permissions: # To push Docker images to GitHub @@ -15,6 +16,20 @@ jobs: docker-build: runs-on: ubuntu-latest steps: + - name: Checkout + uses: actions/checkout@v4 + - name: Docker meta + id: meta + uses: docker/metadata-action@v5 + with: + # list of Docker images to use as base name for tags + images: | + ghcr.io/teamdigitale/dataviz-srv: + # generate Docker tags based on the following events/attributes + tags: | + type=ref,event=branch + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}} - name: Set up QEMU uses: docker/setup-qemu-action@v3 @@ -35,7 +50,7 @@ jobs: with: file: "Dockerfile.app" platforms: linux/amd64 - push: true - tags: | - ghcr.io/teamdigitale/dataviz-srv:latest - ghcr.io/teamdigitale/dataviz-srv:0.0.1 + context: . + push: ${{ github.event_name != 'pull_request' }} + tags: ${{ steps.meta.outputs.tags }} + labels: ${{ steps.meta.outputs.labels }}