add an input argument to specify whether to run 'rustup self update'

This commit is contained in:
Yusuke Sasaki 2019-10-15 18:11:12 +09:00
parent 941154aed5
commit db898a40d0
3 changed files with 11 additions and 2 deletions

View File

@ -19,6 +19,9 @@ inputs:
override:
description: Set installed toolchain as an override for a directory
default: false
self_update:
description: Update rustup itself at first
default: false
runs:
using: 'node12'

View File

@ -30,7 +30,8 @@ export interface ToolchainOptions {
name: string,
target?: string,
default: boolean,
override: boolean
override: boolean,
self_update: boolean,
}
export function toolchain_args(): ToolchainOptions {
@ -38,6 +39,7 @@ export function toolchain_args(): ToolchainOptions {
name: getInput('toolchain', {required: true}),
target: getInput('target') || undefined,
default: inputBoolean('default'),
override: inputBoolean('override')
override: inputBoolean('override'),
self_update: inputBoolean('self_update'),
};
}

View File

@ -74,6 +74,10 @@ async function run() {
const opts = args.toolchain_args();
const rustup = await get_rustup(opts.name);
if (opts.self_update) {
await exec.exec(rustup, ['self', 'update']);
}
await exec.exec(rustup, ['toolchain', 'install', opts.name]);
if (opts.default) {