From 9b189ea06acac81c07f347f9e6686ca3f9dfde55 Mon Sep 17 00:00:00 2001 From: nickosh Date: Tue, 27 Aug 2024 18:35:02 +0900 Subject: [PATCH] CI: wokflow changes - Image will bi build only on release; --- .github/workflows/docker-build-push.yml | 26 ++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/.github/workflows/docker-build-push.yml b/.github/workflows/docker-build-push.yml index 5c348ab..6120d07 100644 --- a/.github/workflows/docker-build-push.yml +++ b/.github/workflows/docker-build-push.yml @@ -1,21 +1,19 @@ name: Build and Push Docker Image on: - push: - branches: [ "main" ] - pull_request: - branches: [ "main" ] + release: + types: [published] env: - REGISTRY: ghcr.io - IMAGE_NAME: ${{ github.repository }} + REGISTRY: ghcr.io + IMAGE_NAME: ${{ github.repository }} jobs: - build-and-push-image: - runs-on: ubuntu-latest - permissions: - contents: read - packages: write + build-and-push-image: + runs-on: ubuntu-latest + permissions: + contents: read + packages: write steps: - name: Checkout repository @@ -33,6 +31,12 @@ jobs: uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} + tags: | + type=semver,pattern={{version}} + type=semver,pattern={{major}}.{{minor}}.{{patch}} + type=semver,pattern={{major}}.{{minor}} + type=semver,pattern={{major}} + type=raw,value=latest - name: Build and push Docker image uses: docker/build-push-action@v6