File tree Expand file tree Collapse file tree
.github/actions/docker-push Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -12,18 +12,28 @@ runs:
1212 - name : Set up Docker Buildx
1313 uses : docker/setup-buildx-action@v3
1414
15- - name : Generate Docker Metadata
16- id : metadata
15+ - name : Generate Docker Metadata for Tag
16+ if : startsWith(github.ref, 'refs/tags/')
17+ id : metadata_tag
1718 uses : docker/metadata-action@v5
1819 with :
1920 images : ${{ inputs.image }}
2021 tags : |
2122 type=ref,event=tag
22- type=ref,ref=branch
2323 type=semver,pattern={{version}}
2424 type=semver,pattern={{major}}.{{minor}}
2525 flavor : latest=${{ inputs.latest }}
2626
27+ - name : Generate Docker Metadata for Branch
28+ if : startsWith(github.ref, 'refs/heads/')
29+ id : metadata_branch
30+ uses : docker/metadata-action@v5
31+ with :
32+ images : ${{ inputs.image }}
33+ tags : |
34+ type=ref,event=branch
35+ flavor : latest=false
36+
2737 - name : Log in to Docker Registry
2838 uses : docker/login-action@v3
2939 with :
3848 file : ${{ inputs.dockerfile }}
3949 platforms : ${{ inputs.platforms }}
4050 push : true
41- tags : ${{ steps.metadata .outputs.tags }}
42- labels : ${{ steps.metadata .outputs.labels }}
51+ tags : ${{ steps.metadata_tag.outputs.tags || steps.metadata_branch .outputs.tags }}
52+ labels : ${{ steps.metadata_tag.outputs.labels || steps.metadata_branch .outputs.labels }}
4353
4454inputs :
4555 registry :
You can’t perform that action at this time.
0 commit comments