Skip to content

Commit ec89399

Browse files
authored
Merge pull request #16 from crazy-max/output
build: rename build-output to output
2 parents 7d74357 + 6875c1b commit ec89399

File tree

3 files changed

+23
-21
lines changed

3 files changed

+23
-21
lines changed

.github/workflows/.test.yml

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -25,12 +25,12 @@ jobs:
2525
packages: write
2626
id-token: write
2727
with:
28+
output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
2829
meta-images: |
2930
public.ecr.aws/q3b5f1u4/test-docker-action
3031
meta-tags: |
3132
type=raw,value=ghbuilder-single-${{ github.run_id }}
3233
build-file: test/hello.Dockerfile
33-
build-output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
3434
build-sbom: true
3535
secrets:
3636
registry-auths: |
@@ -45,12 +45,12 @@ jobs:
4545
packages: write
4646
id-token: write
4747
with:
48+
output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
4849
meta-images: |
4950
public.ecr.aws/q3b5f1u4/test-docker-action
5051
meta-tags: |
5152
type=raw,value=ghbuilder-${{ github.run_id }}
5253
build-file: test/hello.Dockerfile
53-
build-output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
5454
build-sbom: true
5555
build-platforms: linux/amd64,linux/arm64
5656
secrets:
@@ -66,11 +66,11 @@ jobs:
6666
packages: write
6767
id-token: write
6868
with:
69+
output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
6970
meta-images: ghcr.io/docker/github-builder-test
7071
meta-tags: |
7172
type=raw,value=${{ github.run_id }}
7273
build-file: test/hello.Dockerfile
73-
build-output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
7474
build-sbom: true
7575
build-platforms: linux/amd64,linux/arm64
7676
secrets:
@@ -86,11 +86,11 @@ jobs:
8686
packages: write
8787
id-token: write
8888
with:
89+
output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
8990
meta-images: registry-1-stage.docker.io/docker/github-builder-test
9091
meta-tags: |
9192
type=raw,value=${{ github.run_id }}
9293
build-file: test/hello.Dockerfile
93-
build-output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
9494
build-sbom: true
9595
build-platforms: linux/amd64,linux/arm64
9696
secrets:
@@ -106,11 +106,11 @@ jobs:
106106
packages: write
107107
id-token: write
108108
with:
109+
output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
109110
meta-images: registry-1-stage.docker.io/docker/github-builder-test
110111
meta-tags: |
111112
type=raw,value=${{ github.run_id }},prefix=oidc-
112113
build-file: test/hello.Dockerfile
113-
build-output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
114114
build-sbom: true
115115
build-platforms: linux/amd64,linux/arm64
116116
secrets:
@@ -125,13 +125,13 @@ jobs:
125125
packages: write
126126
id-token: write
127127
with:
128+
output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
128129
meta-images: |
129130
ghcr.io/docker/github-builder-test
130131
public.ecr.aws/q3b5f1u4/test-docker-action
131132
meta-tags: |
132133
type=raw,value=${{ github.run_id }},prefix=ghcr-and-aws-
133134
build-file: test/hello.Dockerfile
134-
build-output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
135135
build-sbom: true
136136
build-platforms: linux/amd64,linux/arm64
137137
secrets:
@@ -150,7 +150,7 @@ jobs:
150150
packages: write
151151
id-token: write
152152
with:
153+
output: ${{ github.event_name != 'pull_request' && 'local' || 'cacheonly' }}
153154
build-file: test/hello.Dockerfile
154-
build-output: ${{ github.event_name != 'pull_request' && 'local' || 'cacheonly' }}
155155
build-sbom: true
156156
build-platforms: linux/amd64,linux/arm64

.github/workflows/build.yml

Lines changed: 15 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,11 @@ name: build
33
on:
44
workflow_call:
55
inputs:
6+
output:
7+
type: string
8+
description: "Build output destination (one of cacheonly, registry, local)"
9+
default: 'cacheonly'
10+
required: false
611
cache:
712
type: boolean
813
description: "Enable cache to GitHub Actions cache backend"
@@ -71,11 +76,6 @@ on:
7176
type: string
7277
description: "List of metadata for an image"
7378
required: false
74-
build-output:
75-
type: string
76-
description: "Build output destination (one of cacheonly, registry, local)"
77-
default: 'cacheonly'
78-
required: false
7979
build-platforms:
8080
type: string
8181
description: "List of target platforms to build"
@@ -125,7 +125,7 @@ jobs:
125125
-
126126
name: Docker meta
127127
id: meta
128-
if: ${{ inputs.build-output == 'registry' }}
128+
if: ${{ inputs.output == 'registry' }}
129129
uses: docker/metadata-action@v5
130130
with:
131131
images: ${{ inputs.meta-images }}
@@ -142,7 +142,7 @@ jobs:
142142
INPUT_CACHE: ${{ inputs.cache }}
143143
INPUT_CACHE-MODE: ${{ inputs.cache-mode }}
144144
INPUT_META-IMAGES: ${{ inputs.meta-images }}
145-
INPUT_BUILD-OUTPUT: ${{ inputs.build-output }}
145+
INPUT_BUILD-OUTPUT: ${{ inputs.output }}
146146
INPUT_BUILD-ANNOTATIONS: ${{ inputs.build-annotations }}
147147
INPUT_SET-META-ANNOTATIONS: ${{ inputs.set-meta-annotations }}
148148
INPUT_META-ANNOTATIONS: ${{ steps.meta.outputs.annotations }}
@@ -211,7 +211,7 @@ jobs:
211211
buildkitd-flags: --debug
212212
-
213213
name: Login to registry
214-
if: ${{ inputs.build-output == 'registry' }}
214+
if: ${{ inputs.output == 'registry' }}
215215
# TODO: switch to docker/login-action when OIDC is supported
216216
uses: crazy-max/docker-login-action@dockerhub-oidc
217217
with:
@@ -240,6 +240,7 @@ jobs:
240240
BUILDKIT_MULTI_PLATFORM: 1
241241
-
242242
name: Install @docker/actions-toolkit
243+
if: ${{ inputs.output != 'cacheonly' }}
243244
uses: actions/github-script@v8
244245
env:
245246
INPUT_DAT-MODULE: ${{ env.DOCKER_ACTIONS_TOOLKIT_MODULE }}
@@ -248,6 +249,7 @@ jobs:
248249
await exec.exec('npm', ['install', '--prefer-offline', '--no-audit', core.getInput('dat-module')]);
249250
-
250251
name: Install Cosign
252+
if: ${{ inputs.output != 'cacheonly' }}
251253
uses: actions/github-script@v8
252254
env:
253255
INPUT_COSIGN-VERSION: ${{ env.COSIGN_VERSION }}
@@ -264,7 +266,7 @@ jobs:
264266
await cosign.printVersion();
265267
-
266268
name: Signing attestation manifests
267-
if: ${{ inputs.build-output == 'registry' }}
269+
if: ${{ inputs.output == 'registry' }}
268270
uses: actions/github-script@v8
269271
env:
270272
INPUT_IMAGE-NAMES: ${{ inputs.meta-images }}
@@ -288,7 +290,7 @@ jobs:
288290
);
289291
-
290292
name: Signing local artifacts
291-
if: ${{ inputs.build-output == 'local' }}
293+
if: ${{ inputs.output == 'local' }}
292294
uses: actions/github-script@v8
293295
env:
294296
INPUT_LOCAL-OUTPUT-DIR: ${{ env.LOCAL_EXPORT_DIR }}
@@ -309,7 +311,7 @@ jobs:
309311
);
310312
-
311313
name: Create manifest
312-
if: ${{ inputs.build-output == 'registry' }}
314+
if: ${{ inputs.output == 'registry' }}
313315
uses: actions/github-script@v8
314316
env:
315317
INPUT_IMAGE-NAMES: ${{ inputs.meta-images }}
@@ -333,12 +335,12 @@ jobs:
333335
}
334336
-
335337
name: List local output
336-
if: ${{ inputs.build-output == 'local' }}
338+
if: ${{ inputs.output == 'local' }}
337339
run: |
338340
tree -nh ${{ env.LOCAL_EXPORT_DIR }}
339341
-
340342
name: Upload artifact
341-
if: ${{ inputs.build-output == 'local' }}
343+
if: ${{ inputs.output == 'local' }}
342344
uses: actions/upload-artifact@v5
343345
with:
344346
name: docker-github-builder-assets

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -39,12 +39,12 @@ on:
3939
id-token: write # for signing attestation manifests with GitHub OIDC Token
4040
packages: write # needed to push images to GitHub Container Registry
4141
with:
42+
output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
4243
meta-images: name/app
4344
meta-tags: |
4445
type=ref,event=branch
4546
type=ref,event=pr
4647
type=semver,pattern={{version}}
47-
build-output: ${{ github.event_name != 'pull_request' && 'registry' || 'cacheonly' }}
4848
build-platforms: linux/amd64,linux/arm64
4949
secrets:
5050
registry-auths: |

0 commit comments

Comments
 (0)