mirror of
https://github.com/actions-rs/toolchain.git
synced 2025-08-14 21:05:05 +00:00
add profile support
This commit is contained in:
parent
941154aed5
commit
5185c16d06
@ -45,6 +45,7 @@ See [additional recipes here](https://github.com/actions-rs/meta).
|
|||||||
| `target` | | Additionally install specified target for this toolchain, ex. `x86_64-apple-darwin` | string | |
|
| `target` | | Additionally install specified target for this toolchain, ex. `x86_64-apple-darwin` | string | |
|
||||||
| `default` | | Set installed toolchain as a default toolchain | bool | false |
|
| `default` | | Set installed toolchain as a default toolchain | bool | false |
|
||||||
| `override` | | Set installed toolchain as an override for the current directory | bool | false |
|
| `override` | | Set installed toolchain as an override for the current directory | bool | false |
|
||||||
|
| `profile` | | Profile to specify components to install, ex. `minimal`, `default`, `complete` | string | |
|
||||||
|
|
||||||
## Components
|
## Components
|
||||||
|
|
||||||
|
@ -19,6 +19,9 @@ inputs:
|
|||||||
override:
|
override:
|
||||||
description: Set installed toolchain as an override for a directory
|
description: Set installed toolchain as an override for a directory
|
||||||
default: false
|
default: false
|
||||||
|
profile:
|
||||||
|
description: Profile to install for this toolchain
|
||||||
|
required: false
|
||||||
|
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
|
@ -30,7 +30,8 @@ export interface ToolchainOptions {
|
|||||||
name: string,
|
name: string,
|
||||||
target?: string,
|
target?: string,
|
||||||
default: boolean,
|
default: boolean,
|
||||||
override: boolean
|
override: boolean,
|
||||||
|
profile?: string,
|
||||||
}
|
}
|
||||||
|
|
||||||
export function toolchain_args(): ToolchainOptions {
|
export function toolchain_args(): ToolchainOptions {
|
||||||
@ -38,6 +39,7 @@ export function toolchain_args(): ToolchainOptions {
|
|||||||
name: getInput('toolchain', {required: true}),
|
name: getInput('toolchain', {required: true}),
|
||||||
target: getInput('target') || undefined,
|
target: getInput('target') || undefined,
|
||||||
default: inputBoolean('default'),
|
default: inputBoolean('default'),
|
||||||
override: inputBoolean('override')
|
override: inputBoolean('override'),
|
||||||
|
profile: getInput('profile') || undefined,
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
11
src/main.ts
11
src/main.ts
@ -32,7 +32,7 @@ function downloadRustInit(url: string, name: string): Promise<string> {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
async function get_rustup(toolchain: string): Promise<string> {
|
async function get_rustup(toolchain: string, profile: string): Promise<string> {
|
||||||
try {
|
try {
|
||||||
const foundPath = await io.which('rustup', true);
|
const foundPath = await io.which('rustup', true);
|
||||||
core.debug(`Found rustup at ${foundPath}`);
|
core.debug(`Found rustup at ${foundPath}`);
|
||||||
@ -45,6 +45,8 @@ async function get_rustup(toolchain: string): Promise<string> {
|
|||||||
'-y',
|
'-y',
|
||||||
'--default-toolchain',
|
'--default-toolchain',
|
||||||
toolchain,
|
toolchain,
|
||||||
|
'--profile',
|
||||||
|
profile,
|
||||||
];
|
];
|
||||||
|
|
||||||
// Note: `target` input can't be used here for `--default-host` argument, see #8
|
// Note: `target` input can't be used here for `--default-host` argument, see #8
|
||||||
@ -72,7 +74,12 @@ async function get_rustup(toolchain: string): Promise<string> {
|
|||||||
|
|
||||||
async function run() {
|
async function run() {
|
||||||
const opts = args.toolchain_args();
|
const opts = args.toolchain_args();
|
||||||
const rustup = await get_rustup(opts.name);
|
const profile = opts.profile ? opts.profile : 'default';
|
||||||
|
const rustup = await get_rustup(opts.name, profile);
|
||||||
|
|
||||||
|
if (opts.profile) {
|
||||||
|
await exec.exec(rustup, ['set', 'profile', opts.profile]);
|
||||||
|
}
|
||||||
|
|
||||||
await exec.exec(rustup, ['toolchain', 'install', opts.name]);
|
await exec.exec(rustup, ['toolchain', 'install', opts.name]);
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user