mirror of
https://github.com/docker/build-push-action.git
synced 2025-04-19 01:46:45 +00:00
Handle git sha version of buildx
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
128f05c85a
commit
94827201d1
7 changed files with 39 additions and 38 deletions
|
@ -107,10 +107,14 @@ export async function getVersion(): Promise<string> {
|
|||
});
|
||||
}
|
||||
|
||||
export async function parseVersion(stdout: string): Promise<string> {
|
||||
const matches = /\sv?([0-9.]+)/.exec(stdout);
|
||||
export function parseVersion(stdout: string): string {
|
||||
const matches = /\sv?([0-9a-f]{7}|[0-9.]+)/.exec(stdout);
|
||||
if (!matches) {
|
||||
throw new Error(`Cannot parse buildx version`);
|
||||
}
|
||||
return semver.clean(matches[1]);
|
||||
return matches[1];
|
||||
}
|
||||
|
||||
export function satisfies(version: string, range: string): boolean {
|
||||
return semver.satisfies(version, range) || /^[0-9a-f]{7}$/.exec(version) !== null;
|
||||
}
|
||||
|
|
|
@ -46,9 +46,7 @@ export function defaultContext(): string {
|
|||
if (github.context.sha && !ref.startsWith(`refs/pull/`)) {
|
||||
ref = github.context.sha;
|
||||
}
|
||||
_defaultContext = `${process.env.GITHUB_SERVER_URL || 'https://github.com'}/${github.context.repo.owner}/${
|
||||
github.context.repo.repo
|
||||
}.git#${ref}`;
|
||||
_defaultContext = `${process.env.GITHUB_SERVER_URL || 'https://github.com'}/${github.context.repo.owner}/${github.context.repo.repo}.git#${ref}`;
|
||||
}
|
||||
return _defaultContext;
|
||||
}
|
||||
|
@ -121,10 +119,7 @@ async function getBuildArgs(inputs: Inputs, defaultContext: string, buildxVersio
|
|||
await asyncForEach(inputs.outputs, async output => {
|
||||
args.push('--output', output);
|
||||
});
|
||||
if (
|
||||
!buildx.isLocalOrTarExporter(inputs.outputs) &&
|
||||
(inputs.platforms.length == 0 || semver.satisfies(buildxVersion, '>=0.4.2'))
|
||||
) {
|
||||
if (!buildx.isLocalOrTarExporter(inputs.outputs) && (inputs.platforms.length == 0 || buildx.satisfies(buildxVersion, '>=0.4.2'))) {
|
||||
args.push('--iidfile', await buildx.getImageIDFile());
|
||||
}
|
||||
await asyncForEach(inputs.cacheFrom, async cacheFrom => {
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue