Skip to content

Commit

Permalink
add archive extension to downloaded assets
Browse files Browse the repository at this point in the history
Fixes missing .zip extensions
which breaks on old PowerShell versions
  • Loading branch information
eifinger committed Nov 5, 2024
1 parent d2242d1 commit 7c910b8
Show file tree
Hide file tree
Showing 3 changed files with 22 additions and 20 deletions.
20 changes: 10 additions & 10 deletions dist/setup/index.js

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

11 changes: 6 additions & 5 deletions src/download/download-latest.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@ import * as core from "@actions/core";
import * as tc from "@actions/tool-cache";
import * as exec from "@actions/exec";
import * as path from "node:path";
import { promises as fs } from "node:fs";
import type { Architecture, Platform } from "../utils/platforms";
import { validateChecksum } from "./checksum/checksum";
import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
Expand All @@ -12,18 +13,18 @@ export async function downloadLatest(
checkSum: string | undefined,
githubToken: string | undefined,
): Promise<{ cachedToolDir: string; version: string }> {
const artifact = `uv-${arch}-${platform}`;
let downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/latest/download/${artifact}`;
let artifact = `uv-${arch}-${platform}`;
if (platform === "pc-windows-msvc") {
downloadUrl += ".zip";
artifact += ".zip";
} else {
downloadUrl += ".tar.gz";
artifact += ".tar.gz";
}
const downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/latest/download/${artifact}`;
core.info(`Downloading uv from "${downloadUrl}" ...`);

const downloadPath = await tc.downloadTool(
downloadUrl,
undefined,
artifact,
githubToken,
);
let uvExecutablePath: string;
Expand Down
11 changes: 6 additions & 5 deletions src/download/download-version.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
import * as core from "@actions/core";
import * as tc from "@actions/tool-cache";
import * as path from "node:path";
import { promises as fs } from "node:fs";
import { OWNER, REPO, TOOL_CACHE_NAME } from "../utils/constants";
import type { Architecture, Platform } from "../utils/platforms";
import { validateChecksum } from "./checksum/checksum";
Expand Down Expand Up @@ -29,18 +30,18 @@ export async function downloadVersion(
githubToken: string,
): Promise<{ version: string; cachedToolDir: string }> {
const resolvedVersion = await resolveVersion(version, githubToken);
const artifact = `uv-${arch}-${platform}`;
let downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/download/${resolvedVersion}/${artifact}`;
let artifact = `uv-${arch}-${platform}`;
if (platform === "pc-windows-msvc") {
downloadUrl += ".zip";
artifact += ".zip";
} else {
downloadUrl += ".tar.gz";
artifact += ".tar.gz";
}
const downloadUrl = `https://github.com/${OWNER}/${REPO}/releases/download/${resolvedVersion}/${artifact}`;
core.info(`Downloading uv from "${downloadUrl}" ...`);

const downloadPath = await tc.downloadTool(
downloadUrl,
undefined,
artifact,
githubToken,
);
await validateChecksum(
Expand Down

0 comments on commit 7c910b8

Please sign in to comment.