diff --git a/CHANGELOG.md b/CHANGELOG.md index ff1b16f8..d18957f1 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to ## [unreleased] +### Fixed + +- Add an entry to the registry once the Cygwin cache is restored. + ## [3.0.0-alpha] ### Added diff --git a/dist/index.js b/dist/index.js index 768cabf4..68f9b4b5 100644 --- a/dist/index.js +++ b/dist/index.js @@ -109532,6 +109532,7 @@ const { root: esm_root } = static_namespaceObject; + function createHttpClient() { return new lib.HttpClient("OCamlBot (+https://github.com/ocaml/setup-ocaml)", [], { allowRetries: true, maxRetries: 5 }); } @@ -109586,6 +109587,23 @@ async function setupCygwin() { await io.cp(setup, CYGWIN_ROOT); }); } +async function addCygwinReg() { + const keyname = external_node_path_namespaceObject.join("HKLM", "SOFTWARE", "Cygwin", "setup"); + const valuename = "rootdir"; + const datatype = "REG_SZ"; + const data = CYGWIN_ROOT; + await (0,lib_exec.exec)("reg", [ + "add", + keyname, + "/v", + valuename, + "/t", + datatype, + "/d", + data, + "/f", + ]); +} ;// CONCATENATED MODULE: ./src/cache.ts @@ -109704,6 +109722,9 @@ async function restoreCygwinCache() { const { key, restoreKeys } = await composeCygwinCacheKeys(); const paths = composeCygwinCachePaths(); const cacheKey = await restoreCache(key, restoreKeys, paths); + if (cacheKey) { + await addCygwinReg(); + } return cacheKey; } async function restoreOpamCache() { diff --git a/dist/post/index.js b/dist/post/index.js index 95b63493..c504c59c 100644 --- a/dist/post/index.js +++ b/dist/post/index.js @@ -84916,6 +84916,9 @@ async function restoreCygwinCache() { const { key, restoreKeys } = await composeCygwinCacheKeys(); const paths = composeCygwinCachePaths(); const cacheKey = await restoreCache(key, restoreKeys, paths); + if (cacheKey) { + await addCygwinReg(); + } return cacheKey; } async function restoreOpamCache() { diff --git a/packages/setup-ocaml/src/cache.ts b/packages/setup-ocaml/src/cache.ts index 463b3565..3dcda382 100644 --- a/packages/setup-ocaml/src/cache.ts +++ b/packages/setup-ocaml/src/cache.ts @@ -18,7 +18,7 @@ import { } from "./constants.js"; import { getLatestOpamRelease } from "./opam.js"; import { resolveCompiler } from "./version.js"; -import { getCygwinVersion } from "./windows.js"; +import { addCygwinReg, getCygwinVersion } from "./windows.js"; async function composeCygwinCacheKeys() { const cygwinVersion = await getCygwinVersion(); @@ -151,6 +151,9 @@ async function restoreCygwinCache() { const { key, restoreKeys } = await composeCygwinCacheKeys(); const paths = composeCygwinCachePaths(); const cacheKey = await restoreCache(key, restoreKeys, paths); + if (cacheKey) { + await addCygwinReg(); + } return cacheKey; } diff --git a/packages/setup-ocaml/src/windows.ts b/packages/setup-ocaml/src/windows.ts index 666f20c3..e20965b3 100644 --- a/packages/setup-ocaml/src/windows.ts +++ b/packages/setup-ocaml/src/windows.ts @@ -1,3 +1,4 @@ +import * as path from "node:path"; import * as core from "@actions/core"; import { exec } from "@actions/exec"; import { HttpClient } from "@actions/http-client"; @@ -74,3 +75,21 @@ export async function setupCygwin() { await io.cp(setup, CYGWIN_ROOT); }); } + +export async function addCygwinReg() { + const keyname = path.join("HKLM", "SOFTWARE", "Cygwin", "setup"); + const valuename = "rootdir"; + const datatype = "REG_SZ"; + const data = CYGWIN_ROOT; + await exec("reg", [ + "add", + keyname, + "/v", + valuename, + "/t", + datatype, + "/d", + data, + "/f", + ]); +}