Skip to content

Commit 3edd639

Browse files
authored
GH workflows: docker publish update
explicit permissions added explicit tag handling added
1 parent c4b848b commit 3edd639

File tree

1 file changed

+16
-2
lines changed

1 file changed

+16
-2
lines changed

.github/workflows/docker_publish.yml

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,12 @@ env:
1818
REGISTRY: ghcr.io
1919
IMAGE_NAME: ${{ github.repository }}
2020

21+
permissions:
22+
contents: read
23+
packages: write
24+
attestations: write
25+
id-token: write
26+
2127
jobs:
2228
build-and-push-image:
2329
runs-on: ubuntu-latest
@@ -31,13 +37,21 @@ jobs:
3137
registry: ${{ env.REGISTRY }}
3238
username: ${{ github.actor }}
3339
password: ${{ secrets.GITHUB_TOKEN }}
34-
40+
ref: ${{ github.event_name == 'workflow_dispatch' && inputs.tag || github.ref }}
41+
3542
- name: Extract metadata (tags, labels) for Docker
3643
id: meta
3744
uses: docker/metadata-action@v5
3845
with:
3946
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
40-
47+
tags: |
48+
# Defaults for normal push/PR/schedule events:
49+
type=schedule
50+
type=ref,event=branch
51+
type=ref,event=tag
52+
type=ref,event=pr
53+
type=raw,value=latest,enable={{is_default_branch}}
54+
type=raw,value=${{ inputs.tag }},event=workflow_dispatch
4155
- name: Set up QEMU
4256
uses: docker/setup-qemu-action@v3
4357

0 commit comments

Comments
 (0)