Skip to content

Commit c6f4486

Browse files
committed
feat: add the possibility to pass secrets to the docker build
1 parent af51616 commit c6f4486

2 files changed

Lines changed: 12 additions & 0 deletions

File tree

.github/workflows/build-multiarch.yml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,11 @@ on:
5151
required: false
5252
default: ''
5353
type: string
54+
build_secrets:
55+
description: 'Docker build secrets (multiline id=value). Passed to all arch builds.'
56+
required: false
57+
default: ''
58+
type: string
5459
push_latest:
5560
description: 'Push a :latest tag when building from the main branch'
5661
required: false
@@ -126,6 +131,7 @@ jobs:
126131
VERSION=${{ inputs.version }}
127132
${{ inputs.build_args }}
128133
${{ inputs.build_args_amd64 }}
134+
secrets: ${{ inputs.build_secrets }}
129135

130136
build-arm64:
131137
if: contains(inputs.architectures, 'arm64')
@@ -172,6 +178,7 @@ jobs:
172178
VERSION=${{ inputs.version }}
173179
${{ inputs.build_args }}
174180
${{ inputs.build_args_arm64 }}
181+
secrets: ${{ inputs.build_secrets }}
175182

176183
build-armv7:
177184
# Cross-compile on amd64 — much faster than QEMU emulation on a native armv7 runner
@@ -222,6 +229,7 @@ jobs:
222229
VERSION=${{ inputs.version }}
223230
${{ inputs.build_args }}
224231
${{ inputs.build_args_armv7 }}
232+
secrets: ${{ inputs.build_secrets }}
225233

226234
# ============================================================================
227235
# Create multi-arch manifest combining all successfully built arch images

README.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ Either `RELEASE_TOKEN` or both App secrets must be set.
3434
| `default_version` | `'dev'` | Fallback version when no release is created |
3535
| `dry_run` | `false` | Run semantic-release without creating a tag or release |
3636
| `ref` | `''` | Git ref to checkout (defaults to the triggering ref) |
37+
| `runner` | `'self-hosted'` | Runner label for the prepare job |
3738

3839
#### Outputs
3940

@@ -80,6 +81,7 @@ Builds a Docker image natively on amd64 and arm64 runners, cross-compiles armv7
8081
| `build_args_amd64` | no | `''` | Extra build args for the amd64 job only |
8182
| `build_args_arm64` | no | `''` | Extra build args for the arm64 job only |
8283
| `build_args_armv7` | no | `''` | Extra build args for the armv7 job only |
84+
| `build_secrets` | no | `''` | Docker build secrets (multiline `id=value`) passed to all arch builds |
8385
| `push_latest` | no | `true` | Push a `:latest` tag alongside the version tag |
8486
| `runner_amd64` | no | `arc-runner-set-amd64` | Runner label for amd64 native builds |
8587
| `runner_arm64` | no | `arc-runner-set-arm64` | Runner label for arm64 native builds |
@@ -110,4 +112,6 @@ build:
110112
BASE_IMAGE=ghcr.io/myorg/base:latest-arm64
111113
build_args_armv7: |
112114
BASE_IMAGE=ghcr.io/myorg/base:latest-armv7
115+
build_secrets: |
116+
MY_SECRET=${{ secrets.MY_SECRET }}
113117
```

0 commit comments

Comments
 (0)