Skip to content

Commit

Permalink
fix: Fix binstall 404. (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
milesj authored Aug 4, 2024
1 parent dcab3dc commit 1670d14
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 2 deletions.
5 changes: 5 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -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

- Added a `target-dirs` input, allowing the target folders to be specified. Can now cache multiple
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@moonrepo/setup-rust",
"version": "1.2.0",
"version": "1.2.1",
"description": "A GitHub action for setting up Rust and Cargo.",
"main": "dist/index.js",
"scripts": {
Expand Down
7 changes: 6 additions & 1 deletion src/cargo.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@ import {
} from './cache';
import { rmrf } from './fs';

// eslint-disable-next-line complexity
export async function downloadAndInstallBinstall(binDir: string) {
core.info('cargo-binstall does not exist, attempting to install');

Expand Down Expand Up @@ -62,7 +63,11 @@ export async function downloadAndInstallBinstall(binDir: string) {
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);

if (url.endsWith('.zip')) {
Expand Down

0 comments on commit 1670d14

Please sign in to comment.