@@ -3,13 +3,24 @@ name: 'Release a new version to Github Packages'
33on :
44 release :
55 types : [published]
6+ workflow_dispatch :
7+ inputs :
8+ image_tag :
9+ description : " Docker tag to publish (e.g. 2.0.0-test)"
10+ required : true
11+ type : string
12+ update_latest :
13+ description : " Also overwrite the :latest tag"
14+ required : false
15+ type : boolean
16+ default : false
617
718env :
819 REGISTRY : ghcr.io
920
1021jobs :
1122 push_to_registry :
12- name : Push Docker image to GitHub Packages tagged with "latest" and version number .
23+ name : Push Docker image to GitHub Packages.
1324 runs-on : ubuntu-latest
1425 permissions :
1526 contents : read
@@ -23,16 +34,29 @@ jobs:
2334 registry : ${{ env.REGISTRY }}
2435 username : ${{ github.actor }}
2536 password : ${{ secrets.GITHUB_TOKEN }}
26- - name : Extract metadata (tags, labels) for Docker
27- id : meta
37+ - name : Extract metadata (release path)
38+ if : github.event_name == 'release'
39+ id : meta_release
2840 uses : docker/metadata-action@v5
2941 with :
3042 images :
3143 ghcr.io/${{ github.repository }}
44+ - name : Extract metadata (manual path)
45+ if : github.event_name == 'workflow_dispatch'
46+ id : meta_manual
47+ uses : docker/metadata-action@v5
48+ with :
49+ images :
50+ ghcr.io/${{ github.repository }}
51+ tags : |
52+ type=raw,value=${{ inputs.image_tag }}
53+ type=raw,value=latest,enable=${{ inputs.update_latest }}
54+ flavor : |
55+ latest=false
3256 - name : Push to GitHub Packages
3357 uses : docker/build-push-action@v6
3458 with :
3559 context : .
3660 push : true
37- tags : ${{ steps.meta .outputs.tags }}
38- labels : ${{ steps.meta .outputs.labels }}
61+ tags : ${{ steps.meta_release.outputs.tags || steps.meta_manual .outputs.tags }}
62+ labels : ${{ steps.meta_release.outputs.labels || steps.meta_manual .outputs.labels }}
0 commit comments