From 07977d064ca4a8a3b528e05205932d1b3cb5c52d Mon Sep 17 00:00:00 2001 From: Kevin Stillhammer Date: Sat, 24 Aug 2024 00:27:50 +0200 Subject: [PATCH] Automatically create download dir --- dist/setup/index.js | Bin 3573480 -> 3573773 bytes src/download/download-latest.ts | 7 +++---- src/download/download-version.ts | 12 ++++++------ 3 files changed, 9 insertions(+), 10 deletions(-) diff --git a/dist/setup/index.js b/dist/setup/index.js index b30598c32d91c48b2e5057157b9485d72dd4f4ad..6761126ed8aabfe535a613e5784dc596d8cfb275 100644 GIT binary patch delta 414 zcmb7;ze@sP9LDi3wbOoBS(#Z~si~#+rkR5gG!!IB>Kswm-Ia!D$yrU&@IW*Ofx-(x z(Av@zT=gHcHA_P+(bm7vYedl4@PX&c1E1&nQEQrN7fsVCOyIzy4Q5ziMLPu8U`Gc! z(S>d}(1Tv|!HIqhU=S`0!Hr>fFoIExLBu#F;DrxX|G%;1?fr5EOv**K=m-9mXAusvaAN`&$`F{b1W4qA>(b0 ztZ;&MtXE`3*Hn7-6m}b#9C^2Yo1^#Pd3v5EKBKWg9(iX=zZsQOZAY#a^?wXeHl)!P znaGZ!ri;IW>q57TFfL7Wo#17R45&7UdR|7S$HD7WEd57R?r|7VQ?D7Tp%T zE&A`hr_Wl+Y&QM9x4zkQhd6zW?c06y?V02gRH_S#@{?1Gi}jMrQ#3Sdf&9dh487vi zg4)uugz0ff`l;J@`|Ceuoc<+A-(dUcK>a)1)5YTSwWb^H(6OH0?*lX{BTm1ESrdm* z@rHUSscDI&IVH%39-GeTr*AZQfdbp~)?|IB>35R#J*IyS)VFSrPtgZr10Xg8Vk00n Q24WK+Hr*bdVzy2h00kFs;{X5v diff --git a/src/download/download-latest.ts b/src/download/download-latest.ts index 5690f77..9311358 100644 --- a/src/download/download-latest.ts +++ b/src/download/download-latest.ts @@ -1,7 +1,7 @@ import * as core from '@actions/core' import * as tc from '@actions/tool-cache' -import * as path from 'path' import * as exec from '@actions/exec' +import * as path from 'path' import {Architecture, Platform} from '../utils/platforms' import {validateChecksum} from './checksum/checksum' import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils' @@ -21,10 +21,9 @@ export async function downloadLatest( } core.info(`Downloading uv from "${downloadUrl}" ...`) - const downloadDir = `${process.cwd()}${path.sep}uv` const downloadPath = await tc.downloadTool( downloadUrl, - downloadDir, + undefined, githubToken ) let uvExecutablePath: string @@ -37,7 +36,7 @@ export async function downloadLatest( uvExecutablePath = path.join(extracted, 'uv') } const version = await getVersion(uvExecutablePath) - await validateChecksum(checkSum, downloadPath, arch, platform, version) + await validateChecksum(checkSum, extracted, arch, platform, version) const cachedToolDir = await tc.cacheDir( downloadPath, TOOL_CACHE_NAME, diff --git a/src/download/download-version.ts b/src/download/download-version.ts index e136e49..896492f 100644 --- a/src/download/download-version.ts +++ b/src/download/download-version.ts @@ -1,7 +1,7 @@ import * as core from '@actions/core' import * as tc from '@actions/tool-cache' -import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils' import path from 'path' +import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils' import {Architecture, Platform} from '../utils/platforms' import {validateChecksum} from './checksum/checksum' @@ -31,18 +31,18 @@ export async function downloadVersion( } core.info(`Downloading uv from "${downloadUrl}" ...`) - const downloadDir = `${process.cwd()}${path.sep}uv` const downloadPath = await tc.downloadTool( downloadUrl, - downloadDir, + undefined, githubToken ) await validateChecksum(checkSum, downloadPath, arch, platform, version) + let extractedDir: string if (platform === 'pc-windows-msvc') { - await tc.extractZip(downloadPath) + extractedDir = await tc.extractZip(downloadPath) } else { - tc.extractTar(downloadPath) + extractedDir = await tc.extractTar(downloadPath) } - return await tc.cacheDir(downloadPath, TOOL_CACHE_NAME, version, arch) + return await tc.cacheDir(extractedDir, TOOL_CACHE_NAME, version, arch) }