From 6464cbae991a92fa57e5a252ceb26871a30f62e4 Mon Sep 17 00:00:00 2001 From: Ba Thien Le Date: Tue, 3 Oct 2023 16:14:07 +0200 Subject: [PATCH] refactor: latest tag --- .../workflows/build-and-push-docker-image.yml | 23 ++++++++++++++++--- 1 file changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/build-and-push-docker-image.yml b/.github/workflows/build-and-push-docker-image.yml index ecdcfd43..7cfada71 100644 --- a/.github/workflows/build-and-push-docker-image.yml +++ b/.github/workflows/build-and-push-docker-image.yml @@ -13,6 +13,24 @@ jobs: - name: Set up the repository uses: actions/checkout@v3 + - name: Release check + id: release + run: | + if [[ ${{ github.ref_name }} =~ ^(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)\.(0|[1-9][0-9]*)$ ]]; then + echo "release=true" >> $GITHUB_OUTPUT + else + echo "release=false" >> $GITHUB_OUTPUT + fi + + - name: Extract metadata for Docker + id: meta + uses: docker/metadata-action@v5 + with: + images: cytomineuliege/core + tags: | + type=raw,value=latest,enable=${{ steps.release.outputs.release }} + type=semver,pattern={{raw}} + - name: Set up Docker Buildx uses: docker/setup-buildx-action@v2 @@ -29,7 +47,6 @@ jobs: CORE_VERSION=${{ github.ref_name }} context: . file: ./docker/Dockerfile + labels: ${{ steps.meta.outputs.labels }} push: true - tags: | - cytomineuliege/core:latest - cytomineuliege/core:${{ github.ref_name }} + tags: ${{ steps.meta.outputs.tags }}