diff --git a/CHANGELOG.md b/CHANGELOG.md index ddd6030..3640ea2 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -1,3 +1,7 @@ +# 1.0.0 + +- Added musl support to `cargo-binstall`. + # 0.6.0 - Breaking: Cargo `bins` must provide the `cargo-` crate prefix manually. This change allows diff --git a/package.json b/package.json index afd6432..677a723 100644 --- a/package.json +++ b/package.json @@ -22,7 +22,8 @@ "@actions/glob": "^0.4.0", "@actions/io": "^1.1.3", "@actions/tool-cache": "^2.0.1", - "@ltd/j-toml": "^1.38.0" + "@ltd/j-toml": "^1.38.0", + "detect-libc": "^2.0.2" }, "devDependencies": { "@types/node": "^18.15.11", diff --git a/pnpm-lock.yaml b/pnpm-lock.yaml index 6da911f..66bfd2d 100644 --- a/pnpm-lock.yaml +++ b/pnpm-lock.yaml @@ -22,6 +22,9 @@ dependencies: '@ltd/j-toml': specifier: ^1.38.0 version: 1.38.0 + detect-libc: + specifier: ^2.0.2 + version: 2.0.2 devDependencies: '@types/node': @@ -933,6 +936,11 @@ packages: engines: {node: '>=6'} dev: true + /detect-libc@2.0.2: + resolution: {integrity: sha512-UX6sGumvvqSaXgdKGUsgZWqcUyIXZ/vZTrlRT/iobiKhGL0zL4d3osHj3uqllWJK+i+sixDS/3COVEOFbupFyw==} + engines: {node: '>=8'} + dev: false + /dir-glob@3.0.1: resolution: {integrity: sha512-WkrWp9GR4KXfKGYzOLmTuGVi1UWFfws377n9cc55/tb6DuqyF6pcQ5AbiHEshaDpY9v6oaSr2XCDidGmMwdzIA==} engines: {node: '>=8'} diff --git a/src/cargo.ts b/src/cargo.ts index 4d23112..2655d3a 100644 --- a/src/cargo.ts +++ b/src/cargo.ts @@ -26,6 +26,9 @@ export async function downloadAndInstallBinstall(binDir: string) { case 'x64': arch = 'x86_64'; break; + case 'arm': + arch = 'armv7'; + break; case 'arm64': arch = 'aarch64'; break; @@ -34,9 +37,21 @@ export async function downloadAndInstallBinstall(binDir: string) { } switch (process.platform) { - case 'linux': - file = `${arch}-unknown-linux-gnu.tgz`; + case 'linux': { + const { family } = await import('detect-libc'); + let lib = 'gnu'; + + if ((await family()) === 'musl') { + lib = 'musl'; + } + + if (process.arch === 'arm') { + lib += 'eabihf'; + } + + file = `${arch}-unknown-linux-${lib}.tgz`; break; + } case 'darwin': file = `${arch}-apple-darwin.zip`; break; @@ -220,7 +235,7 @@ export async function restoreCache() { core.saveState('cache-hit-key', cacheKey); core.info(`Cache restored using key ${primaryKey}`); } else { - core.warning(`Cache does not exist using key ${primaryKey}`); + core.info(`Cache does not exist using key ${primaryKey}`); } core.setOutput('cache-key', cacheKey ?? primaryKey);