@@ -144,20 +144,42 @@ jobs:
144144 type=sha,enable=true
145145 # Version tag is only needed for released versions.
146146 type=semver,pattern={{version}},value=v${{ env.PKG_VERSION }},enable=${{ contains(fromJSON(needs.release.outputs.paths_released), '.') }}
147+
148+ # Extract metadata for Docker Hub.
149+ # This is only needed for releases.
150+ - name : Extract Metadata for Docker Hub
151+ id : meta-dockerhub
152+ uses : docker/metadata-action@v5
153+ with :
154+ images : abinnovision/github-workflow-dispatch-proxy
155+ tags : |
156+ type=semver,pattern={{version}},value=v${{ env.PKG_VERSION }},enable=${{ contains(fromJSON(needs.release.outputs.paths_released), '.') }}
157+
147158 - name : Container Registry Auth
148159 uses : docker/login-action@v3
149160 with :
150161 registry : ${{ env.DOCKER_REGISTRY }}
151162 username : ${{ github.actor }}
152163 password : ${{ secrets.GITHUB_TOKEN }}
164+
165+ # Login to Docker Hub only if a release is published.
166+ - name : Login to Docker Hub
167+ uses : docker/login-action@v3
168+ if : contains(fromJSON(needs.release.outputs.paths_released), '.')
169+ with :
170+ username : ${{ secrets.DOCKERHUB_USERNAME }}
171+ password : ${{ secrets.DOCKERHUB_TOKEN }}
172+
153173 - name : Build image
154174 uses : docker/build-push-action@v4
155175 with :
156176 context : " ."
157177 push : true
158178 file : Dockerfile
159179 labels : ${{ steps.meta.outputs.labels }}
160- tags : ${{ steps.meta.outputs.tags }}
180+ tags : |
181+ ${{ steps.meta.outputs.tags }}
182+ ${{ steps.meta-dockerhub.outputs.tags }}
161183 secrets : |
162184 NPM_ABINNOVISION_AUTH_TOKEN=${{ github.token }}
163185 cleanup-registry :
0 commit comments