diff --git a/dist/index.js b/dist/index.js index 809fe89..01bef6e 100644 --- a/dist/index.js +++ b/dist/index.js @@ -11907,7 +11907,7 @@ async function installRustTarget(target, toolchain) { else if ((0, fs_1.existsSync)(res.stdout.trim())) { return; } - if (toolchain.length > 0) { + if (toolchain && toolchain.length > 0) { await exec.exec('rustup', [ 'target', 'add', @@ -11940,13 +11940,13 @@ function setupSccacheEnv() { async function hostBuild(maturinRelease, args) { const command = core.getInput('command'); const target = getRustTarget(args); - const rustToolchain = (await getRustToolchain(args)) || 'stable'; + const rustToolchain = await getRustToolchain(args); const rustupComponents = core.getInput('rustup-components'); const workdir = getWorkingDirectory(); const sccache = core.getBooleanInput('sccache'); const isUniversal2 = args.includes('--universal2') || target === 'universal2-apple-darwin'; core.startGroup('Install Rust target'); - if (rustToolchain.length > 0) { + if (rustToolchain && rustToolchain.length > 0) { core.info(`Installing Rust toolchain ${rustToolchain}`); await exec.exec('rustup', ['override', 'set', rustToolchain]); await exec.exec('rustup', ['component', 'add', 'llvm-tools-preview'], { diff --git a/src/index.ts b/src/index.ts index db2526a..846bcc2 100644 --- a/src/index.ts +++ b/src/index.ts @@ -712,7 +712,7 @@ async function installRustTarget( // Target already installed return } - if (toolchain.length > 0) { + if (toolchain && toolchain.length > 0) { await exec.exec('rustup', [ 'target', 'add', @@ -759,7 +759,9 @@ async function hostBuild( ): Promise { const command = core.getInput('command') const target = getRustTarget(args) - const rustToolchain = (await getRustToolchain(args)) || 'stable' + // rust toolchain doesn't have a default version so we can use the one + // that's already installed + const rustToolchain = await getRustToolchain(args) const rustupComponents = core.getInput('rustup-components') const workdir = getWorkingDirectory() const sccache = core.getBooleanInput('sccache') @@ -767,7 +769,7 @@ async function hostBuild( args.includes('--universal2') || target === 'universal2-apple-darwin' core.startGroup('Install Rust target') - if (rustToolchain.length > 0) { + if (rustToolchain && rustToolchain.length > 0) { core.info(`Installing Rust toolchain ${rustToolchain}`) await exec.exec('rustup', ['override', 'set', rustToolchain]) await exec.exec('rustup', ['component', 'add', 'llvm-tools-preview'], {