Skip to content

Commit 0a1157c

Browse files
authored
Merge pull request #820 from ocaml/fix-opam-selector
Fix selector to select the correct opam release asset
2 parents 15003b1 + 672583e commit 0a1157c

File tree

3 files changed

+18
-4
lines changed

3 files changed

+18
-4
lines changed

CHANGELOG.md

+4
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,10 @@ and this project adheres to
88

99
## [unreleased]
1010

11+
### Fixed
12+
13+
- Fix asset selector to select the correct opam release asset.
14+
1115
## [3.0.0-beta]
1216

1317
### Changed

dist/index.js

+6-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

packages/setup-ocaml/src/opam.ts

+8-3
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,14 @@ export async function getLatestOpamRelease() {
4242
"Could not retrieve the opam release matching the version constraint",
4343
);
4444
}
45-
const matchedAssets = latestRelease.assets.find((asset) =>
46-
asset.browser_download_url.includes(`${ARCHITECTURE}-${PLATFORM}`),
47-
);
45+
const matchedAssets = latestRelease.assets.find((asset) => {
46+
if (PLATFORM === "windows") {
47+
return asset.browser_download_url.endsWith(
48+
`${ARCHITECTURE}-${PLATFORM}.exe`,
49+
);
50+
}
51+
return asset.browser_download_url.endsWith(`${ARCHITECTURE}-${PLATFORM}`);
52+
});
4853
if (!matchedAssets) {
4954
throw new Error(
5055
"Could not find any assets matching the current platform or architecture",

0 commit comments

Comments
 (0)