fix: Fix binstall 404. (#21)

This commit is contained in:
Miles Johnson 2024-08-03 22:14:37 -07:00 committed by GitHub
parent dcab3dcf9f
commit 1670d14080
No known key found for this signature in database
GPG key ID: B5690EEEBB952194
3 changed files with 12 additions and 2 deletions

View file

@ -1,3 +1,8 @@
# 1.2.1
- Pinned the `cargo-binstall` version to v1.8 to work around the 404 errors in CI.
- Added support for the `CARGO_BINSTALL_VERSION` environment variable.
# 1.2.0 # 1.2.0
- Added a `target-dirs` input, allowing the target folders to be specified. Can now cache multiple - Added a `target-dirs` input, allowing the target folders to be specified. Can now cache multiple

View file

@ -1,6 +1,6 @@
{ {
"name": "@moonrepo/setup-rust", "name": "@moonrepo/setup-rust",
"version": "1.2.0", "version": "1.2.1",
"description": "A GitHub action for setting up Rust and Cargo.", "description": "A GitHub action for setting up Rust and Cargo.",
"main": "dist/index.js", "main": "dist/index.js",
"scripts": { "scripts": {

View file

@ -17,6 +17,7 @@ import {
} from './cache'; } from './cache';
import { rmrf } from './fs'; import { rmrf } from './fs';
// eslint-disable-next-line complexity
export async function downloadAndInstallBinstall(binDir: string) { export async function downloadAndInstallBinstall(binDir: string) {
core.info('cargo-binstall does not exist, attempting to install'); core.info('cargo-binstall does not exist, attempting to install');
@ -62,7 +63,11 @@ export async function downloadAndInstallBinstall(binDir: string) {
throw new Error(`Unsupported platform: ${process.platform}`); throw new Error(`Unsupported platform: ${process.platform}`);
} }
const url = `https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-${file}`; // https://github.com/cargo-bins/cargo-binstall/issues/1864
const version = process.env.CARGO_BINSTALL_VERSION ?? 'v1.8.0';
const url = version === 'latest'
? `https://github.com/cargo-bins/cargo-binstall/releases/latest/download/cargo-binstall-${file}`
: `https://github.com/cargo-bins/cargo-binstall/releases/download/${version}/cargo-binstall-${file}`;
const dlPath = await tc.downloadTool(url); const dlPath = await tc.downloadTool(url);
if (url.endsWith('.zip')) { if (url.endsWith('.zip')) {