@@ -2,8 +2,6 @@ name: Continuous Integration
22
33on :
44 push :
5- branches : ['master','main'] # Trigger on the pushes to master & main branches
6- tags : [ '[0-9]+.[0-9]+.[0-9]+' ]
75
86jobs :
97 test :
@@ -18,25 +16,23 @@ jobs:
1816 name : Build and Publish
1917 needs : test
2018 runs-on : ubuntu-latest
19+ if : github.ref_name == 'master' || startsWith(github.ref, 'refs/tags/')
2120 steps :
2221 - uses : actions/checkout@v4
23-
24- # Step to login to DockerHub
22+
2523 - name : Log in to Docker Hub
2624 uses : docker/login-action@v3
2725 with :
2826 username : ${{ secrets.DOCKERHUB_USERNAME }}
2927 password : ${{ secrets.DOCKERHUB_TOKEN }}
30-
31- # Step to login to GitHub Container Registry
28+
3229 - name : Log in to GHCR
3330 uses : docker/login-action@v3
3431 with :
3532 registry : ghcr.io
3633 username : ${{ github.actor}}
3734 password : ${{ secrets.GITHUB_TOKEN}}
38-
39- # Extract metadata for the Docker images using the semver
35+
4036 - name : Extract metadata (tags, labels) for Docker
4137 id : meta
4238 uses : docker/metadata-action@v5
@@ -50,12 +46,10 @@ jobs:
5046 type=semver,pattern={{major.minor}}
5147
5248
53- # Build and push Docker image to GHCR and Docker Hub
5449 - name : Build and push Docker image
5550 uses : docker/build-push-action@v5
5651 with :
5752 context : .
5853 push : true
5954 tags : ${{ steps.meta.outputs.tags }}
60- labels : ${{ steps.meta.outputs.labels }}
61-
55+ labels : ${{ steps.meta.outputs.labels }}
0 commit comments