File tree Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Expand file tree Collapse file tree 1 file changed +8
-5
lines changed Original file line number Diff line number Diff line change 88 - " v*.*.*" # Triggers on tag push for versioned tags (e.g., v1.0.0)
99
1010jobs :
11- build :
11+ build-and-push :
1212 runs-on : ubuntu-latest
1313 steps :
1414 - name : Checkout code
@@ -17,13 +17,14 @@ jobs:
1717 - name : Set up Docker Buildx
1818 uses : docker/setup-buildx-action@v2
1919
20- - name : Log in to Quay.io
20+ - name : Log in to Quay.io (only if pushing)
21+ if : startsWith(github.ref, 'refs/tags/')
2122 run : echo "${{ secrets.DOCKER_PASSWORD }}" | docker login quay.io -u "${{ secrets.DOCKER_USERNAME }}" --password-stdin
2223
2324 - name : Get tag or commit SHA
2425 id : vars
2526 run : |
26- if [ "${{ github.event_name }}" = "push" ] && [ -n "${{ github.ref_name }}" ]; then
27+ if [[ "${{ github.ref }}" == refs/tags/* ] ]; then
2728 echo "image_tag=${{ github.ref_name }}" >> $GITHUB_ENV
2829 else
2930 echo "image_tag=${{ github.sha }}" >> $GITHUB_ENV
3233 - name : Build Docker Image
3334 run : make build
3435
35- - name : Tag Docker Image
36+ - name : Tag Docker Image (only if pushing)
37+ if : startsWith(github.ref, 'refs/tags/')
3638 run : docker tag fleet-telemetry-consumer quay.io/rajsinghcpre/fleet-telemetry-consumer:${{ env.image_tag }}
3739
38- - name : Push Docker Image
40+ - name : Push Docker Image (only if pushing)
41+ if : startsWith(github.ref, 'refs/tags/')
3942 run : docker push quay.io/rajsinghcpre/fleet-telemetry-consumer:${{ env.image_tag }}
You can’t perform that action at this time.
0 commit comments