Avoid leftover files by using temp dir (#150)

Fixes: #149
This commit is contained in:
Kevin Stillhammer 2024-11-06 12:52:46 +01:00 committed by GitHub
parent a7e15805d2
commit 2e657c127d
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
3 changed files with 18 additions and 8 deletions

14
dist/setup/index.js generated vendored
View File

@ -89710,6 +89710,7 @@ const core = __importStar(__nccwpck_require__(7484));
const tc = __importStar(__nccwpck_require__(3472)); const tc = __importStar(__nccwpck_require__(3472));
const exec = __importStar(__nccwpck_require__(5236)); const exec = __importStar(__nccwpck_require__(5236));
const path = __importStar(__nccwpck_require__(6760)); const path = __importStar(__nccwpck_require__(6760));
const node_fs_1 = __nccwpck_require__(3024);
const checksum_1 = __nccwpck_require__(5391); const checksum_1 = __nccwpck_require__(5391);
const constants_1 = __nccwpck_require__(6156); const constants_1 = __nccwpck_require__(6156);
function downloadLatest(platform, arch, checkSum, githubToken) { function downloadLatest(platform, arch, checkSum, githubToken) {
@ -89721,11 +89722,13 @@ function downloadLatest(platform, arch, checkSum, githubToken) {
} }
const downloadUrl = `https://github.com/${constants_1.OWNER}/${constants_1.REPO}/releases/latest/download/${artifact}${extension}`; const downloadUrl = `https://github.com/${constants_1.OWNER}/${constants_1.REPO}/releases/latest/download/${artifact}${extension}`;
core.info(`Downloading uv from "${downloadUrl}" ...`); core.info(`Downloading uv from "${downloadUrl}" ...`);
const downloadPath = yield tc.downloadTool(downloadUrl, `${artifact}${extension}`, githubToken); const downloadPath = yield tc.downloadTool(downloadUrl, undefined, githubToken);
let uvExecutablePath; let uvExecutablePath;
let uvDir; let uvDir;
if (platform === "pc-windows-msvc") { if (platform === "pc-windows-msvc") {
uvDir = yield tc.extractZip(downloadPath); const fullPathWithExtension = `${downloadPath}${extension}`;
yield node_fs_1.promises.copyFile(downloadPath, fullPathWithExtension);
uvDir = yield tc.extractZip(fullPathWithExtension);
// On windows extracting the zip does not create an intermediate directory // On windows extracting the zip does not create an intermediate directory
uvExecutablePath = path.join(uvDir, "uv.exe"); uvExecutablePath = path.join(uvDir, "uv.exe");
} }
@ -89807,6 +89810,7 @@ exports.downloadVersion = downloadVersion;
const core = __importStar(__nccwpck_require__(7484)); const core = __importStar(__nccwpck_require__(7484));
const tc = __importStar(__nccwpck_require__(3472)); const tc = __importStar(__nccwpck_require__(3472));
const path = __importStar(__nccwpck_require__(6760)); const path = __importStar(__nccwpck_require__(6760));
const node_fs_1 = __nccwpck_require__(3024);
const constants_1 = __nccwpck_require__(6156); const constants_1 = __nccwpck_require__(6156);
const checksum_1 = __nccwpck_require__(5391); const checksum_1 = __nccwpck_require__(5391);
const github = __importStar(__nccwpck_require__(3228)); const github = __importStar(__nccwpck_require__(3228));
@ -89831,11 +89835,13 @@ function downloadVersion(platform, arch, version, checkSum, githubToken) {
} }
const downloadUrl = `https://github.com/${constants_1.OWNER}/${constants_1.REPO}/releases/download/${resolvedVersion}/${artifact}${extension}`; const downloadUrl = `https://github.com/${constants_1.OWNER}/${constants_1.REPO}/releases/download/${resolvedVersion}/${artifact}${extension}`;
core.info(`Downloading uv from "${downloadUrl}" ...`); core.info(`Downloading uv from "${downloadUrl}" ...`);
const downloadPath = yield tc.downloadTool(downloadUrl, `${artifact}${extension}`, githubToken); const downloadPath = yield tc.downloadTool(downloadUrl, undefined, githubToken);
yield (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, resolvedVersion); yield (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, resolvedVersion);
let uvDir; let uvDir;
if (platform === "pc-windows-msvc") { if (platform === "pc-windows-msvc") {
uvDir = yield tc.extractZip(downloadPath); const fullPathWithExtension = `${downloadPath}${extension}`;
yield node_fs_1.promises.copyFile(downloadPath, fullPathWithExtension);
uvDir = yield tc.extractZip(fullPathWithExtension);
// On windows extracting the zip does not create an intermediate directory // On windows extracting the zip does not create an intermediate directory
} }
else { else {

View File

@ -23,13 +23,15 @@ export async function downloadLatest(
const downloadPath = await tc.downloadTool( const downloadPath = await tc.downloadTool(
downloadUrl, downloadUrl,
`${artifact}${extension}`, undefined,
githubToken, githubToken,
); );
let uvExecutablePath: string; let uvExecutablePath: string;
let uvDir: string; let uvDir: string;
if (platform === "pc-windows-msvc") { if (platform === "pc-windows-msvc") {
uvDir = await tc.extractZip(downloadPath); const fullPathWithExtension = `${downloadPath}${extension}`;
await fs.copyFile(downloadPath, fullPathWithExtension);
uvDir = await tc.extractZip(fullPathWithExtension);
// On windows extracting the zip does not create an intermediate directory // On windows extracting the zip does not create an intermediate directory
uvExecutablePath = path.join(uvDir, "uv.exe"); uvExecutablePath = path.join(uvDir, "uv.exe");
} else { } else {

View File

@ -40,7 +40,7 @@ export async function downloadVersion(
const downloadPath = await tc.downloadTool( const downloadPath = await tc.downloadTool(
downloadUrl, downloadUrl,
`${artifact}${extension}`, undefined,
githubToken, githubToken,
); );
await validateChecksum( await validateChecksum(
@ -53,7 +53,9 @@ export async function downloadVersion(
let uvDir: string; let uvDir: string;
if (platform === "pc-windows-msvc") { if (platform === "pc-windows-msvc") {
uvDir = await tc.extractZip(downloadPath); const fullPathWithExtension = `${downloadPath}${extension}`;
await fs.copyFile(downloadPath, fullPathWithExtension);
uvDir = await tc.extractZip(fullPathWithExtension);
// On windows extracting the zip does not create an intermediate directory // On windows extracting the zip does not create an intermediate directory
} else { } else {
const extractedDir = await tc.extractTar(downloadPath); const extractedDir = await tc.extractTar(downloadPath);