handlebar defaultContext support for build-contexts input

Signed-off-by: CrazyMax <1951866+crazy-max@users.noreply.github.com>
pull/1283/head
CrazyMax 2024-12-17 15:26:12 +01:00
parent bcc9f4afe7
commit 49c623eaf8
No known key found for this signature in database
GPG Key ID: ADE44D8C9D44FBE4
1 changed files with 6 additions and 1 deletions

View File

@ -132,7 +132,12 @@ async function getBuildArgs(inputs: Inputs, context: string, toolkit: Toolkit):
}); });
if (await toolkit.buildx.versionSatisfies('>=0.8.0')) { if (await toolkit.buildx.versionSatisfies('>=0.8.0')) {
await Util.asyncForEach(inputs['build-contexts'], async buildContext => { await Util.asyncForEach(inputs['build-contexts'], async buildContext => {
args.push('--build-context', buildContext); args.push(
'--build-context',
handlebars.compile(buildContext)({
defaultContext: Context.gitContext()
})
);
}); });
} else if (inputs['build-contexts'].length > 0) { } else if (inputs['build-contexts'].length > 0) {
core.warning("Build contexts are only supported by buildx >= 0.8.0; the input 'build-contexts' is ignored."); core.warning("Build contexts are only supported by buildx >= 0.8.0; the input 'build-contexts' is ignored.");