mirror of
https://github.com/docker/setup-buildx-action.git
synced 2025-04-23 08:26:38 +02:00
Explicit version spec for caching
Signed-off-by: CrazyMax <crazy-max@users.noreply.github.com>
This commit is contained in:
parent
e673438944
commit
580d5c72a2
4 changed files with 27 additions and 10 deletions
|
@ -117,11 +117,16 @@ export async function build(inputBuildRef: string, dockerConfigHome: string): Pr
|
|||
ref = 'master';
|
||||
}
|
||||
|
||||
const sha = await git.getRemoteSha(repo, ref);
|
||||
core.debug(`Remote ref ${sha} found`);
|
||||
let vspec: string;
|
||||
if (ref.match(/^[0-9a-fA-F]{40}$/)) {
|
||||
vspec = ref;
|
||||
} else {
|
||||
vspec = await git.getRemoteSha(repo, ref);
|
||||
}
|
||||
core.debug(`Tool version spec ${vspec}`);
|
||||
|
||||
let toolPath: string;
|
||||
toolPath = tc.find('buildx', sha);
|
||||
toolPath = tc.find('buildx', vspec);
|
||||
if (!toolPath) {
|
||||
const outFolder = path.join(context.tmpDir(), 'out').split(path.sep).join(path.posix.sep);
|
||||
toolPath = await exec
|
||||
|
@ -132,7 +137,7 @@ export async function build(inputBuildRef: string, dockerConfigHome: string): Pr
|
|||
if (res.stderr.length > 0 && res.exitCode != 0) {
|
||||
core.warning(res.stderr.trim());
|
||||
}
|
||||
return tc.cacheFile(`${outFolder}/buildx`, context.osPlat == 'win32' ? 'docker-buildx.exe' : 'docker-buildx', 'buildx', sha);
|
||||
return tc.cacheFile(`${outFolder}/buildx`, context.osPlat == 'win32' ? 'docker-buildx.exe' : 'docker-buildx', 'buildx', vspec);
|
||||
});
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue