Skip to content

Commit

Permalink
Fix asset selector to select the correct opam release asset
Browse files Browse the repository at this point in the history
Signed-off-by: Sora Morimoto <sora@morimoto.io>
  • Loading branch information
smorimoto committed Jul 1, 2024
1 parent 15003b1 commit 672583e
Show file tree
Hide file tree
Showing 3 changed files with 18 additions and 4 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 6 additions & 1 deletion dist/index.js

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

11 changes: 8 additions & 3 deletions packages/setup-ocaml/src/opam.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down

0 comments on commit 672583e

Please sign in to comment.