diff --git a/CHANGELOG.md b/CHANGELOG.md index 2b021536..0001bbb3 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -8,6 +8,10 @@ and this project adheres to ## [unreleased] +### Fixed + +- Fix asset selector to select the correct opam release asset. + ## [3.0.0-beta] ### Changed diff --git a/dist/index.js b/dist/index.js index 35fc5294..7cc2cb33 100644 --- a/dist/index.js +++ b/dist/index.js @@ -92085,7 +92085,12 @@ async function getLatestOpamRelease() { if (!latestRelease) { throw new Error("Could not retrieve the opam release matching the version constraint"); } - const matchedAssets = latestRelease.assets.find((asset) => asset.browser_download_url.includes(`${ARCHITECTURE}-${PLATFORM}`)); + const matchedAssets = latestRelease.assets.find((asset) => { + if (PLATFORM === "windows") { + return asset.browser_download_url.endsWith(`${ARCHITECTURE}-${PLATFORM}.exe`); + } + return asset.browser_download_url.endsWith(`${ARCHITECTURE}-${PLATFORM}`); + }); if (!matchedAssets) { throw new Error("Could not find any assets matching the current platform or architecture"); } diff --git a/packages/setup-ocaml/src/opam.ts b/packages/setup-ocaml/src/opam.ts index b9ea81a6..85547515 100644 --- a/packages/setup-ocaml/src/opam.ts +++ b/packages/setup-ocaml/src/opam.ts @@ -42,9 +42,14 @@ export async function getLatestOpamRelease() { "Could not retrieve the opam release matching the version constraint", ); } - const matchedAssets = latestRelease.assets.find((asset) => - asset.browser_download_url.includes(`${ARCHITECTURE}-${PLATFORM}`), - ); + const matchedAssets = latestRelease.assets.find((asset) => { + if (PLATFORM === "windows") { + return asset.browser_download_url.endsWith( + `${ARCHITECTURE}-${PLATFORM}.exe`, + ); + } + return asset.browser_download_url.endsWith(`${ARCHITECTURE}-${PLATFORM}`); + }); if (!matchedAssets) { throw new Error( "Could not find any assets matching the current platform or architecture",