Skip to content

Commit 603dec1

Browse files
authored
Update CI build workflow permissions and conditions
1 parent 299c8ea commit 603dec1

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

.github/workflows/ci-build.yml

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,11 @@ on:
2626

2727
name: ci-build
2828

29+
permissions:
30+
contents: read
31+
actions: write
32+
packages: write
33+
2934
env:
3035
DOTNET_VERSION: 10.0.x
3136
REGISTRY: ghcr.io
@@ -130,8 +135,8 @@ jobs:
130135
latest=false
131136
tags: |
132137
type=raw,value={{branch}},enable=${{ github.ref_type == 'branch' && github.event_name != 'pull_request' }}
133-
type=raw,value=latest,enable=${{ inputs.latest || false }}
134-
type=raw,value=rc,enable=${{ inputs.rc || false }}
138+
type=raw,value=latest,enable=${{ github.event_name == 'workflow_call' && (inputs.latest || false) }}
139+
type=raw,value=rc,enable=${{ github.event_name == 'workflow_call' && (inputs.rc || false) }}
135140
type=ref,event=branch
136141
type=ref,event=pr
137142
type=semver,pattern={{major}},enable=${{ !startsWith(github.ref, 'refs/tags/v0.') }}
@@ -143,7 +148,7 @@ jobs:
143148
with:
144149
context: .
145150
file: Dockerfile
146-
push: ${{ inputs.latest || inputs.rc || (github.ref_protected && github.event_name != 'pull_request') }}
151+
push: ${{ (github.event_name == 'workflow_call' && (inputs.latest || inputs.rc)) || (github.ref_protected && github.event_name != 'pull_request') }}
147152
tags: ${{ steps.meta.outputs.tags }}
148153
labels: ${{ steps.meta.outputs.labels }}
149154
platforms: ${{ inputs.platforms || 'linux/amd64' }}

0 commit comments

Comments
 (0)