Skip to content

Commit

Permalink
tc -> toolCache
Browse files Browse the repository at this point in the history
Signed-off-by: Sora Morimoto <sora@morimoto.io>
  • Loading branch information
smorimoto committed Nov 26, 2023
1 parent 5141167 commit 30f56e6
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 21 deletions.
20 changes: 10 additions & 10 deletions dist/post/index.js

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

26 changes: 15 additions & 11 deletions packages/setup-ocaml/src/opam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import * as core from "@actions/core";
import { exec, getExecOutput } from "@actions/exec";
import * as github from "@actions/github";
import * as io from "@actions/io";
import * as tc from "@actions/tool-cache";
import * as toolCache from "@actions/tool-cache";
import * as semver from "semver";

import { saveCygwinCache } from "./cache.js";
Expand Down Expand Up @@ -76,11 +76,11 @@ async function findOpam() {

async function acquireOpamUnix() {
const { version, browserDownloadUrl } = await getLatestOpamRelease();
const cachedPath = tc.find("opam", version, ARCHITECTURE);
const cachedPath = toolCache.find("opam", version, ARCHITECTURE);
if (cachedPath === "") {
const downloadedPath = await tc.downloadTool(browserDownloadUrl);
const downloadedPath = await toolCache.downloadTool(browserDownloadUrl);
core.info(`Acquired ${version} from ${browserDownloadUrl}`);
const cachedPath = await tc.cacheFile(
const cachedPath = await toolCache.cacheFile(
downloadedPath,
"opam",
"opam",
Expand Down Expand Up @@ -161,12 +161,12 @@ async function setupOpamUnix() {

async function setupCygwin() {
const version = await getCygwinVersion();
const cachedPath = tc.find("cygwin", version, "x86_64");
const cachedPath = toolCache.find("cygwin", version, "x86_64");
if (cachedPath === "") {
const downloadedPath = await tc.downloadTool(
const downloadedPath = await toolCache.downloadTool(
"https://cygwin.com/setup-x86_64.exe",
);
const cachedPath = await tc.cacheFile(
const cachedPath = await toolCache.cacheFile(
downloadedPath,
"setup-x86_64.exe",
"cygwin",
Expand Down Expand Up @@ -208,13 +208,17 @@ async function setupCygwin() {

async function acquireOpamWindows() {
const opamVersion = "0.0.0.2";
const cachedPath = tc.find("opam", opamVersion);
const cachedPath = toolCache.find("opam", opamVersion);
if (cachedPath === "") {
const downloadedPath = await tc.downloadTool(
const downloadedPath = await toolCache.downloadTool(
`https://github.com/fdopen/opam-repository-mingw/releases/download/${opamVersion}/opam64.zip`,
);
const extractedPath = await tc.extractZip(downloadedPath);
const cachedPath = await tc.cacheDir(extractedPath, "opam", opamVersion);
const extractedPath = await toolCache.extractZip(downloadedPath);
const cachedPath = await toolCache.cacheDir(
extractedPath,
"opam",
opamVersion,
);
const installSh = path.join(cachedPath, "opam64", "install.sh");
await fs.chmod(installSh, 0o755);
await exec("bash", [installSh, "--prefix", "/usr"]);
Expand Down

0 comments on commit 30f56e6

Please sign in to comment.