diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index e15f9cc..0f7330b 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -3,6 +3,8 @@ on: push: branches: - main + tags: + - 'v*.*.*' env: REGISTRY: ghcr.io @@ -19,6 +21,7 @@ jobs: uses: actions/checkout@b4ffde65f46336ab88eb53be808477a3936bae11 # v4 - name: Log into registry ${{ env.REGISTRY }} + if: github.ref_type == 'tag' uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} @@ -30,13 +33,12 @@ jobs: uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }} - tags: type=sha,prefix=,suffix=,format=short - name: Build and push image uses: docker/build-push-action@v5 with: context: . file: Dockerfile - push: true + push: ${{ github.ref_type == 'tag' }} tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }}