rename utils/utils.ts to constants.ts (#59)

This commit is contained in:
Kevin Stillhammer 2024-09-07 14:13:50 +02:00 committed by GitHub
parent 417c97acee
commit b463f5b8ca
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
6 changed files with 29 additions and 29 deletions

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

@ -85634,11 +85634,11 @@ const tc = __importStar(__nccwpck_require__(7784));
const exec = __importStar(__nccwpck_require__(1514));
const path = __importStar(__nccwpck_require__(1017));
const checksum_1 = __nccwpck_require__(4622);
const utils_1 = __nccwpck_require__(239);
const constants_1 = __nccwpck_require__(8593);
function downloadLatest(platform, arch, checkSum, githubToken) {
return __awaiter(this, void 0, void 0, function* () {
const artifact = `uv-${arch}-${platform}`;
let downloadUrl = `https://github.com/${utils_1.OWNER}/${utils_1.REPO}/releases/latest/download/${artifact}`;
let downloadUrl = `https://github.com/${constants_1.OWNER}/${constants_1.REPO}/releases/latest/download/${artifact}`;
if (platform === "pc-windows-msvc") {
downloadUrl += ".zip";
}
@ -85661,7 +85661,7 @@ function downloadLatest(platform, arch, checkSum, githubToken) {
}
const version = yield getVersion(uvExecutablePath);
yield (0, checksum_1.validateChecksum)(checkSum, downloadPath, arch, platform, version);
const cachedToolDir = yield tc.cacheDir(uvDir, utils_1.TOOL_CACHE_NAME, version, arch);
const cachedToolDir = yield tc.cacheDir(uvDir, constants_1.TOOL_CACHE_NAME, version, arch);
return { cachedToolDir, version };
});
}
@ -85732,18 +85732,18 @@ exports.downloadVersion = downloadVersion;
const core = __importStar(__nccwpck_require__(2186));
const tc = __importStar(__nccwpck_require__(7784));
const path = __importStar(__nccwpck_require__(1017));
const utils_1 = __nccwpck_require__(239);
const constants_1 = __nccwpck_require__(8593);
const checksum_1 = __nccwpck_require__(4622);
function tryGetFromToolCache(arch, version) {
core.debug(`Trying to get uv from tool cache for ${version}...`);
const cachedVersions = tc.findAllVersions(utils_1.TOOL_CACHE_NAME, arch);
const cachedVersions = tc.findAllVersions(constants_1.TOOL_CACHE_NAME, arch);
core.debug(`Cached versions: ${cachedVersions}`);
return tc.find(utils_1.TOOL_CACHE_NAME, version, arch);
return tc.find(constants_1.TOOL_CACHE_NAME, version, arch);
}
function downloadVersion(platform, arch, version, checkSum, githubToken) {
return __awaiter(this, void 0, void 0, function* () {
const artifact = `uv-${arch}-${platform}`;
let downloadUrl = `https://github.com/${utils_1.OWNER}/${utils_1.REPO}/releases/download/${version}/${artifact}`;
let downloadUrl = `https://github.com/${constants_1.OWNER}/${constants_1.REPO}/releases/download/${version}/${artifact}`;
if (platform === "pc-windows-msvc") {
downloadUrl += ".zip";
}
@ -85762,7 +85762,7 @@ function downloadVersion(platform, arch, version, checkSum, githubToken) {
const extractedDir = yield tc.extractTar(downloadPath);
uvDir = path.join(extractedDir, artifact);
}
return yield tc.cacheDir(uvDir, utils_1.TOOL_CACHE_NAME, version, arch);
return yield tc.cacheDir(uvDir, constants_1.TOOL_CACHE_NAME, version, arch);
});
}
@ -85878,6 +85878,20 @@ function addMatchers() {
run();
/***/ }),
/***/ 8593:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
exports.REPO = "uv";
exports.OWNER = "astral-sh";
exports.TOOL_CACHE_NAME = "uv";
/***/ }),
/***/ 9378:
@ -85971,20 +85985,6 @@ function getPlatform() {
}
/***/ }),
/***/ 239:
/***/ ((__unused_webpack_module, exports) => {
"use strict";
Object.defineProperty(exports, "__esModule", ({ value: true }));
exports.TOOL_CACHE_NAME = exports.OWNER = exports.REPO = void 0;
exports.REPO = "uv";
exports.OWNER = "astral-sh";
exports.TOOL_CACHE_NAME = "uv";
/***/ }),
/***/ 2877:

View File

@ -32787,7 +32787,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
Object.defineProperty(exports, "__esModule", ({ value: true }));
const github = __importStar(__nccwpck_require__(5438));
const core = __importStar(__nccwpck_require__(2186));
const utils_1 = __nccwpck_require__(239);
const constants_1 = __nccwpck_require__(8593);
const semver = __importStar(__nccwpck_require__(5911));
const update_known_checksums_1 = __nccwpck_require__(7554);
function run() {
@ -32796,8 +32796,8 @@ function run() {
const github_token = process.argv.slice(2)[1];
const octokit = github.getOctokit(github_token);
const response = yield octokit.paginate(octokit.rest.repos.listReleases, {
owner: utils_1.OWNER,
repo: utils_1.REPO,
owner: constants_1.OWNER,
repo: constants_1.REPO,
});
const downloadUrls = response.flatMap((release) => release.assets
.filter((asset) => asset.name.endsWith(".sha256"))
@ -32814,7 +32814,7 @@ run();
/***/ }),
/***/ 239:
/***/ 8593:
/***/ ((__unused_webpack_module, exports) => {
"use strict";

View File

@ -4,7 +4,7 @@ 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";
import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
export async function downloadLatest(
platform: Platform,

View File

@ -1,7 +1,7 @@
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 { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
import { Architecture, Platform } from "../utils/platforms";
import { validateChecksum } from "./checksum/checksum";

View File

@ -1,7 +1,7 @@
import * as github from "@actions/github";
import * as core from "@actions/core";
import { OWNER, REPO } from "./utils/utils";
import { OWNER, REPO } from "./utils/constants";
import * as semver from "semver";
import { updateChecksums } from "./download/checksum/update-known-checksums";