mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-01-19 16:28:18 +08:00
Automatically create download dir
This commit is contained in:
parent
67efd41074
commit
07977d064c
BIN
dist/setup/index.js
generated
vendored
BIN
dist/setup/index.js
generated
vendored
Binary file not shown.
@ -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,
|
||||
|
@ -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)
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user