File tree Expand file tree Collapse file tree 1 file changed +9
-4
lines changed
Expand file tree Collapse file tree 1 file changed +9
-4
lines changed Original file line number Diff line number Diff line change 11name : Build and publish docker image
22on :
3- workflow_dispatch :
3+ workflow_dispatch :
44 push :
55 branches :
66 - main
1717 runs-on : ubuntu-latest
1818 permissions :
1919 contents : read
20+ # Required to push images to GitHub Container Registry (ghcr.io)
21+ packages : write
2022 # Gives the action the ability to mint the OIDC token necessary to request a Sigstore signing certificate
2123 id-token : write
2224 # Permission necessary to persist the attestation
@@ -32,18 +34,21 @@ jobs:
3234 uses : docker/login-action@v3
3335 with :
3436 registry : ${{ env.REGISTRY }}
35- username : ${{ github.actor }}
37+ # Repo-scoped username for audit clarity; write access is granted by GITHUB_TOKEN (repo token)
38+ username : ${{ github.repository }}
3639 password : ${{ secrets.GITHUB_TOKEN }}
3740 - name : Extract metadata (tags, labels) for Docker
3841 id : meta
3942 uses : docker/metadata-action@v5
4043 with :
4144 images : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
4245 tags : |
46+ # Branch name as tag (and semver for v* tag pushes only)
4347 type=ref,event=branch
44- type=ref,event=pr
4548 type=semver,pattern={{version}}
4649 type=semver,pattern={{major}}.{{minor}}
50+ # So GHCR shows "latest" instead of the image digest
51+ type=raw,value=latest
4752 - name : Build and push Docker image
4853 id : push
4954 uses : docker/build-push-action@v6
5762 with :
5863 subject-name : ${{ env.REGISTRY }}/${{ env.IMAGE_NAME}}
5964 subject-digest : ${{ steps.push.outputs.digest }}
60- push-to-registry : true
65+ push-to-registry : true
You can’t perform that action at this time.
0 commit comments