From d3bb0542fb7cd74174e62c11d42f50b6b5a24170 Mon Sep 17 00:00:00 2001 From: briskt <3172830+briskt@users.noreply.github.com> Date: Thu, 21 Nov 2024 18:37:21 +0800 Subject: [PATCH] push image on feature branches --- .github/workflows/test-and-publish.yml | 11 +++++------ 1 file changed, 5 insertions(+), 6 deletions(-) diff --git a/.github/workflows/test-and-publish.yml b/.github/workflows/test-and-publish.yml index 7c2ddec..5453589 100644 --- a/.github/workflows/test-and-publish.yml +++ b/.github/workflows/test-and-publish.yml @@ -2,8 +2,6 @@ name: Test and Publish on: push: - branches: [ 'main' ] #Triger on the main branch - tags: [ '[0-9]+.[0-9]+.[0-9]+' ] # Trigger on version tags like '0.1.0' jobs: tests: @@ -39,10 +37,11 @@ jobs: - name: Log in to GitHub Container Registry uses: docker/login-action@v3 + if: startsWith(github.ref, 'refs/tags') with: - registry: ghcr.io - username: ${{ github.actor }} - password: ${{ secrets.GITHUB_TOKEN }} + registry: ghcr.io + username: ${{ github.actor }} + password: ${{ secrets.GITHUB_TOKEN }} - name: Extract metadata (tags, labels) for Docker id: meta @@ -55,7 +54,7 @@ jobs: type=ref,event=branch type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} - + - name: Build and push Docker image uses: docker/build-push-action@v5 with: