mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-01-31 22:41:27 +08:00
Automatically create download dir
This commit is contained in:
parent
67efd41074
commit
07977d064c
21
dist/setup/index.js
generated
vendored
21
dist/setup/index.js
generated
vendored
@ -85394,8 +85394,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||||||
exports.downloadLatest = void 0;
|
exports.downloadLatest = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const tc = __importStar(__nccwpck_require__(7784));
|
const tc = __importStar(__nccwpck_require__(7784));
|
||||||
const path = __importStar(__nccwpck_require__(1017));
|
|
||||||
const exec = __importStar(__nccwpck_require__(1514));
|
const exec = __importStar(__nccwpck_require__(1514));
|
||||||
|
const io = __importStar(__nccwpck_require__(7436));
|
||||||
|
const path = __importStar(__nccwpck_require__(1017));
|
||||||
const checksum_1 = __nccwpck_require__(4622);
|
const checksum_1 = __nccwpck_require__(4622);
|
||||||
const utils_1 = __nccwpck_require__(239);
|
const utils_1 = __nccwpck_require__(239);
|
||||||
function downloadLatest(platform, arch, checkSum, githubToken) {
|
function downloadLatest(platform, arch, checkSum, githubToken) {
|
||||||
@ -85409,7 +85410,8 @@ function downloadLatest(platform, arch, checkSum, githubToken) {
|
|||||||
downloadUrl += '.tar.gz';
|
downloadUrl += '.tar.gz';
|
||||||
}
|
}
|
||||||
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
||||||
const downloadDir = `${process.cwd()}${path.sep}uv`;
|
const downloadDir = path.join(process.env['RUNNER_TEMP'] || '', 'uv-download');
|
||||||
|
yield io.mkdirP(downloadDir);
|
||||||
const downloadPath = yield tc.downloadTool(downloadUrl, downloadDir, githubToken);
|
const downloadPath = yield tc.downloadTool(downloadUrl, downloadDir, githubToken);
|
||||||
let uvExecutablePath;
|
let uvExecutablePath;
|
||||||
let extracted;
|
let extracted;
|
||||||
@ -85422,7 +85424,7 @@ function downloadLatest(platform, arch, checkSum, githubToken) {
|
|||||||
uvExecutablePath = path.join(extracted, 'uv');
|
uvExecutablePath = path.join(extracted, 'uv');
|
||||||
}
|
}
|
||||||
const version = yield getVersion(uvExecutablePath);
|
const version = yield getVersion(uvExecutablePath);
|
||||||
yield (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, version);
|
yield (0, checksum_1.validateChecksum)(checkSum, extracted, arch, platform, version);
|
||||||
const cachedToolDir = yield tc.cacheDir(downloadPath, utils_1.TOOL_CACHE_NAME, version, arch);
|
const cachedToolDir = yield tc.cacheDir(downloadPath, utils_1.TOOL_CACHE_NAME, version, arch);
|
||||||
return { cachedToolDir, version };
|
return { cachedToolDir, version };
|
||||||
});
|
});
|
||||||
@ -85496,8 +85498,9 @@ Object.defineProperty(exports, "__esModule", ({ value: true }));
|
|||||||
exports.downloadVersion = exports.tryGetFromToolCache = void 0;
|
exports.downloadVersion = exports.tryGetFromToolCache = void 0;
|
||||||
const core = __importStar(__nccwpck_require__(2186));
|
const core = __importStar(__nccwpck_require__(2186));
|
||||||
const tc = __importStar(__nccwpck_require__(7784));
|
const tc = __importStar(__nccwpck_require__(7784));
|
||||||
const utils_1 = __nccwpck_require__(239);
|
const io = __importStar(__nccwpck_require__(7436));
|
||||||
const path_1 = __importDefault(__nccwpck_require__(1017));
|
const path_1 = __importDefault(__nccwpck_require__(1017));
|
||||||
|
const utils_1 = __nccwpck_require__(239);
|
||||||
const checksum_1 = __nccwpck_require__(4622);
|
const checksum_1 = __nccwpck_require__(4622);
|
||||||
function tryGetFromToolCache(arch, version) {
|
function tryGetFromToolCache(arch, version) {
|
||||||
core.debug(`Trying to get uv from tool cache for ${version}...`);
|
core.debug(`Trying to get uv from tool cache for ${version}...`);
|
||||||
@ -85517,16 +85520,18 @@ function downloadVersion(platform, arch, version, checkSum, githubToken) {
|
|||||||
downloadUrl += '.tar.gz';
|
downloadUrl += '.tar.gz';
|
||||||
}
|
}
|
||||||
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
||||||
const downloadDir = `${process.cwd()}${path_1.default.sep}uv`;
|
const downloadDir = path_1.default.join(process.env['RUNNER_TEMP'] || '', 'uv-download');
|
||||||
|
yield io.mkdirP(downloadDir);
|
||||||
const downloadPath = yield tc.downloadTool(downloadUrl, downloadDir, githubToken);
|
const downloadPath = yield tc.downloadTool(downloadUrl, downloadDir, githubToken);
|
||||||
yield (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, version);
|
yield (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, version);
|
||||||
|
let extractedDir;
|
||||||
if (platform === 'pc-windows-msvc') {
|
if (platform === 'pc-windows-msvc') {
|
||||||
yield tc.extractZip(downloadPath);
|
extractedDir = yield tc.extractZip(downloadPath);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
tc.extractTar(downloadPath);
|
extractedDir = yield tc.extractTar(downloadPath);
|
||||||
}
|
}
|
||||||
return yield tc.cacheDir(downloadPath, utils_1.TOOL_CACHE_NAME, version, arch);
|
return yield tc.cacheDir(extractedDir, utils_1.TOOL_CACHE_NAME, version, arch);
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
exports.downloadVersion = downloadVersion;
|
exports.downloadVersion = downloadVersion;
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as tc from '@actions/tool-cache'
|
import * as tc from '@actions/tool-cache'
|
||||||
import * as path from 'path'
|
|
||||||
import * as exec from '@actions/exec'
|
import * as exec from '@actions/exec'
|
||||||
|
import * as path from 'path'
|
||||||
import {Architecture, Platform} from '../utils/platforms'
|
import {Architecture, Platform} from '../utils/platforms'
|
||||||
import {validateChecksum} from './checksum/checksum'
|
import {validateChecksum} from './checksum/checksum'
|
||||||
import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils'
|
import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils'
|
||||||
@ -21,10 +21,9 @@ export async function downloadLatest(
|
|||||||
}
|
}
|
||||||
core.info(`Downloading uv from "${downloadUrl}" ...`)
|
core.info(`Downloading uv from "${downloadUrl}" ...`)
|
||||||
|
|
||||||
const downloadDir = `${process.cwd()}${path.sep}uv`
|
|
||||||
const downloadPath = await tc.downloadTool(
|
const downloadPath = await tc.downloadTool(
|
||||||
downloadUrl,
|
downloadUrl,
|
||||||
downloadDir,
|
undefined,
|
||||||
githubToken
|
githubToken
|
||||||
)
|
)
|
||||||
let uvExecutablePath: string
|
let uvExecutablePath: string
|
||||||
@ -37,7 +36,7 @@ export async function downloadLatest(
|
|||||||
uvExecutablePath = path.join(extracted, 'uv')
|
uvExecutablePath = path.join(extracted, 'uv')
|
||||||
}
|
}
|
||||||
const version = await getVersion(uvExecutablePath)
|
const version = await getVersion(uvExecutablePath)
|
||||||
await validateChecksum(checkSum, downloadPath, arch, platform, version)
|
await validateChecksum(checkSum, extracted, arch, platform, version)
|
||||||
const cachedToolDir = await tc.cacheDir(
|
const cachedToolDir = await tc.cacheDir(
|
||||||
downloadPath,
|
downloadPath,
|
||||||
TOOL_CACHE_NAME,
|
TOOL_CACHE_NAME,
|
||||||
|
@ -1,7 +1,7 @@
|
|||||||
import * as core from '@actions/core'
|
import * as core from '@actions/core'
|
||||||
import * as tc from '@actions/tool-cache'
|
import * as tc from '@actions/tool-cache'
|
||||||
import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils'
|
|
||||||
import path from 'path'
|
import path from 'path'
|
||||||
|
import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils'
|
||||||
import {Architecture, Platform} from '../utils/platforms'
|
import {Architecture, Platform} from '../utils/platforms'
|
||||||
import {validateChecksum} from './checksum/checksum'
|
import {validateChecksum} from './checksum/checksum'
|
||||||
|
|
||||||
@ -31,18 +31,18 @@ export async function downloadVersion(
|
|||||||
}
|
}
|
||||||
core.info(`Downloading uv from "${downloadUrl}" ...`)
|
core.info(`Downloading uv from "${downloadUrl}" ...`)
|
||||||
|
|
||||||
const downloadDir = `${process.cwd()}${path.sep}uv`
|
|
||||||
const downloadPath = await tc.downloadTool(
|
const downloadPath = await tc.downloadTool(
|
||||||
downloadUrl,
|
downloadUrl,
|
||||||
downloadDir,
|
undefined,
|
||||||
githubToken
|
githubToken
|
||||||
)
|
)
|
||||||
await validateChecksum(checkSum, downloadPath, arch, platform, version)
|
await validateChecksum(checkSum, downloadPath, arch, platform, version)
|
||||||
|
|
||||||
|
let extractedDir: string
|
||||||
if (platform === 'pc-windows-msvc') {
|
if (platform === 'pc-windows-msvc') {
|
||||||
await tc.extractZip(downloadPath)
|
extractedDir = await tc.extractZip(downloadPath)
|
||||||
} else {
|
} 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)
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user