Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
7 changes: 7 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,13 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0

## [Unreleased]

### Changed

- The `CARGO_INSTALL_ROOT` environment variable is set when running `cargo install`.
This allows sub-processed using the `cargo install` command (such as
[yazi's build script](https://github.com/sxyazi/yazi/blob/c27ef58116794de7f559bca74e60e6e13ae92051/yazi-build/build.rs#L37))
to use the right installation path.

## [3.3.1] - 2025-06-17

### Changed
Expand Down
5 changes: 4 additions & 1 deletion dist/index.js

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

4 changes: 3 additions & 1 deletion src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,9 @@ async function run(): Promise<void> {
core.startGroup(
`No cached version found, installing ${input.crate} using cargo...`,
);
await exec.exec('cargo', install.args);

const env = { ...process.env, ...install.env } as Record<string, string>;
await exec.exec('cargo', install.args, { env });

try {
await cache.saveCache([install.path], install.cacheKey);
Expand Down
3 changes: 3 additions & 0 deletions src/install.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ export type ResolvedVersion =
export interface InstallSettings {
path: string;
args: string[];
env: Record<string, string>;
cacheKey: string;
}

Expand All @@ -29,11 +30,13 @@ export async function getInstallSettings(

const installPath = path.join(homePath, '.cargo-install', input.crate);
const args = getInstallArgs(input, version, installPath);
const env = { CARGO_INSTALL_ROOT: installPath };
const cacheKey = await getCacheKey(input, version, args);

return {
path: installPath,
args,
env,
cacheKey,
};
}
Expand Down
Loading