mirror of
https://github.com/imranismail/setup-kustomize.git
synced 2026-06-13 17:30:54 +00:00
Fix versioning
This commit is contained in:
@@ -144,7 +144,13 @@ async function acquireKustomize(version: string): Promise<string> {
|
|||||||
version = semver.clean(version) || '';
|
version = semver.clean(version) || '';
|
||||||
|
|
||||||
let downloadUrl: string;
|
let downloadUrl: string;
|
||||||
let downloadPath: string;
|
let toolPath: string;
|
||||||
|
let toolFilename = "kustomize";
|
||||||
|
let toolName = "kustomize";
|
||||||
|
|
||||||
|
if (osPlat == "win32") {
|
||||||
|
toolFilename = `${toolFilename}.exe`
|
||||||
|
}
|
||||||
|
|
||||||
if (semver.gte(version, "3.3.0")) {
|
if (semver.gte(version, "3.3.0")) {
|
||||||
downloadUrl = `https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${version}/kustomize_v${version}_%{os}_%{arch}.tar.gz`;
|
downloadUrl = `https://github.com/kubernetes-sigs/kustomize/releases/download/kustomize/v${version}/kustomize_v${version}_%{os}_%{arch}.tar.gz`;
|
||||||
@@ -177,23 +183,16 @@ async function acquireKustomize(version: string): Promise<string> {
|
|||||||
}
|
}
|
||||||
|
|
||||||
try {
|
try {
|
||||||
downloadPath = await tc.downloadTool(downloadUrl);
|
toolPath = await tc.downloadTool(downloadUrl);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
core.debug(err);
|
core.debug(err);
|
||||||
|
|
||||||
throw `Failed to download version ${version}: ${err}`;
|
throw `Failed to download version ${version}: ${err}`;
|
||||||
}
|
}
|
||||||
|
|
||||||
let toolPath = downloadPath;
|
|
||||||
|
|
||||||
if (downloadUrl.endsWith('.tar.gz')) {
|
if (downloadUrl.endsWith('.tar.gz')) {
|
||||||
let extPath = await tc.extractTar(downloadPath);
|
toolPath = await tc.extractTar(toolPath);
|
||||||
toolPath = path.join(extPath, "kustomize")
|
toolPath = path.join(toolPath, toolFilename)
|
||||||
}
|
}
|
||||||
|
|
||||||
if (osPlat == "win32") {
|
return await tc.cacheFile(toolPath, toolFilename, toolName, version);
|
||||||
toolPath = `${toolPath}.exe`
|
|
||||||
}
|
|
||||||
|
|
||||||
return await tc.cacheFile(downloadPath, 'kustomize', 'kustomize', version);
|
|
||||||
}
|
}
|
||||||
Reference in New Issue
Block a user