Skip to content

Commit

Permalink
Merge pull request #820 from ocaml/fix-opam-selector
Browse files Browse the repository at this point in the history
Fix selector to select the correct opam release asset
  • Loading branch information
smorimoto authored Jul 1, 2024
2 parents 15003b1 + 672583e commit 0a1157c
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 0a1157c

Please sign in to comment.