11name : Upload Docker image
22
3- on :
4- release :
3+ on :
4+ release :
55 types : [published]
6- workflow_dispatch :
6+ workflow_dispatch :
77 inputs :
88 release_tag :
99 description : ' Release tag to build Docker image for'
1010 required : true
1111 type : string
1212
13- concurrency :
13+ concurrency :
1414 group : ${{ github.workflow }}-${{ github.ref }}
15- cancel-in-progress : true
15+ cancel-in-progress : true
1616
1717jobs :
1818 push_to_registries :
@@ -22,34 +22,40 @@ jobs:
2222 packages : write
2323 contents : read
2424 steps :
25- - name : Check out the repo
26- uses : actions/checkout@v3
25+ - name : Check out the repo
26+ uses : actions/checkout@v3
27+ with :
28+ ref : ${{ github.event.inputs.release_tag || github.ref }}
2729
2830 - name : Log in to Docker Hub
2931 uses : docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
30- with :
31- username : ${{ secrets.DOCKER_USERNAME }}
32+ with :
33+ username : ${{ secrets. DOCKER_USERNAME }}
3234 password : ${{ secrets.DOCKER_PASSWORD }}
3335
3436 - name : Log in to the Container registry
3537 uses : docker/login-action@f054a8b539a109f9f41c372932f1ae047eff08c9
3638 with :
3739 registry : ghcr.io
3840 username : ${{ github.actor }}
39- password : ${{ secrets.GITHUB_TOKEN }}
41+ password : ${{ secrets. GITHUB_TOKEN }}
4042
4143 - name : Extract metadata (tags, labels) for Docker
4244 id : meta
4345 uses : docker/metadata-action@98669ae865ea3cffbcbaa878cf57c20bbf1c6c38
44- with :
46+ with :
4547 images : |
4648 pyprophet/pyprophet
4749 ghcr.io/${{ github.repository }}
50+ tags : |
51+ type=raw,value=${{ github.event.inputs.release_tag }},enable=${{ github.event. inputs.release_tag != '' }}
52+ type=ref,event=tag
53+ type=raw,value=latest,enable=${{ github.event_name == 'release' || github.event. inputs.release_tag != '' }}
4854
4955 - name : Build and push Docker images
50- uses : docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
56+ uses : docker/build-push-action@ad44023a93711e3deb337508980b4b5e9bcdc5dc
5157 with :
52- context : .
58+ context : .
5359 push : true
5460 tags : ${{ steps.meta.outputs.tags }}
5561 labels : ${{ steps.meta.outputs.labels }}
0 commit comments