mirror of
https://github.com/astral-sh/setup-uv.git
synced 2025-05-18 07:04:45 +00:00
Change Prettier settings (#36)
## Summary I know this is a little tedious but I'd prefer to use the same settings as in Ruff.
This commit is contained in:
parent
1785c7bde0
commit
182c9c7e92
32 changed files with 5536 additions and 5497 deletions
|
@ -1,18 +1,18 @@
|
|||
import * as core from '@actions/core'
|
||||
import * as tc from '@actions/tool-cache'
|
||||
import * as path from 'path'
|
||||
import {OWNER, REPO, TOOL_CACHE_NAME} from '../utils/utils'
|
||||
import {Architecture, Platform} from '../utils/platforms'
|
||||
import {validateChecksum} from './checksum/checksum'
|
||||
import * as core from "@actions/core";
|
||||
import * as tc from "@actions/tool-cache";
|
||||
import * as path from "path";
|
||||
import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/utils";
|
||||
import { Architecture, Platform } from "../utils/platforms";
|
||||
import { validateChecksum } from "./checksum/checksum";
|
||||
|
||||
export function tryGetFromToolCache(
|
||||
arch: Architecture,
|
||||
version: string
|
||||
version: string,
|
||||
): string | undefined {
|
||||
core.debug(`Trying to get uv from tool cache for ${version}...`)
|
||||
const cachedVersions = tc.findAllVersions(TOOL_CACHE_NAME, arch)
|
||||
core.debug(`Cached versions: ${cachedVersions}`)
|
||||
return tc.find(TOOL_CACHE_NAME, version, arch)
|
||||
core.debug(`Trying to get uv from tool cache for ${version}...`);
|
||||
const cachedVersions = tc.findAllVersions(TOOL_CACHE_NAME, arch);
|
||||
core.debug(`Cached versions: ${cachedVersions}`);
|
||||
return tc.find(TOOL_CACHE_NAME, version, arch);
|
||||
}
|
||||
|
||||
export async function downloadVersion(
|
||||
|
@ -20,32 +20,32 @@ export async function downloadVersion(
|
|||
arch: Architecture,
|
||||
version: string,
|
||||
checkSum: string | undefined,
|
||||
githubToken: string | undefined
|
||||
githubToken: string | undefined,
|
||||
): Promise<string> {
|
||||
const artifact = `uv-${arch}-${platform}`
|
||||
let downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/download/${version}/${artifact}`
|
||||
if (platform === 'pc-windows-msvc') {
|
||||
downloadUrl += '.zip'
|
||||
const artifact = `uv-${arch}-${platform}`;
|
||||
let downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/download/${version}/${artifact}`;
|
||||
if (platform === "pc-windows-msvc") {
|
||||
downloadUrl += ".zip";
|
||||
} else {
|
||||
downloadUrl += '.tar.gz'
|
||||
downloadUrl += ".tar.gz";
|
||||
}
|
||||
core.info(`Downloading uv from "${downloadUrl}" ...`)
|
||||
core.info(`Downloading uv from "${downloadUrl}" ...`);
|
||||
|
||||
const downloadPath = await tc.downloadTool(
|
||||
downloadUrl,
|
||||
undefined,
|
||||
githubToken
|
||||
)
|
||||
await validateChecksum(checkSum, downloadPath, arch, platform, version)
|
||||
githubToken,
|
||||
);
|
||||
await validateChecksum(checkSum, downloadPath, arch, platform, version);
|
||||
|
||||
let uvDir: string
|
||||
if (platform === 'pc-windows-msvc') {
|
||||
uvDir = await tc.extractZip(downloadPath)
|
||||
let uvDir: string;
|
||||
if (platform === "pc-windows-msvc") {
|
||||
uvDir = await tc.extractZip(downloadPath);
|
||||
// On windows extracting the zip does not create an intermediate directory
|
||||
} else {
|
||||
const extractedDir = await tc.extractTar(downloadPath)
|
||||
uvDir = path.join(extractedDir, artifact)
|
||||
const extractedDir = await tc.extractTar(downloadPath);
|
||||
uvDir = path.join(extractedDir, artifact);
|
||||
}
|
||||
|
||||
return await tc.cacheDir(uvDir, TOOL_CACHE_NAME, version, arch)
|
||||
return await tc.cacheDir(uvDir, TOOL_CACHE_NAME, version, arch);
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue