diff --git a/CHANGELOG.md b/CHANGELOG.md index b7eb5c0..c020c9b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,16 @@ All notable changes to this project will be documented in this file. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). +## [1.1.0] - 2021-07-19 + +### Added + +- `targets` input now takes a comma-separated list of targets rather than a single target + +### Changed + +- `target` input is now an alias for `targets` + ## [1.0.6] - 2020-03-24 ### Added diff --git a/README.md b/README.md index d379697..5ab0a89 100644 --- a/README.md +++ b/README.md @@ -59,7 +59,7 @@ See [additional recipes here](https://github.com/actions-rs/meta). | Name | Required | Description | Type | Default | | ------------ | :------: | ----------------------------------------------------------------------------------------------------------------------------------------------------| ------ | --------| | `toolchain` | | [Toolchain](https://github.com/rust-lang/rustup.rs#toolchain-specification) name to use, ex. `stable`, `nightly`, `nightly-2019-04-20`, or `1.32.0` | string | stable | -| `target` | | Additionally install specified target for this toolchain, ex. `x86_64-apple-darwin` | string | | +| `targets` | | Comma-separated list of additional targets to install for this toolchain, ex. `x86_64-apple-darwin` | string | | | `default` | | Set installed toolchain as a default toolchain | bool | false | | `override` | | Set installed toolchain as an override for the current directory | bool | false | | `profile` | | Execute `rustup set profile {value}` before installing the toolchain, ex. `minimal` | string | default | diff --git a/action.yml b/action.yml index baf2dfe..6f997f2 100644 --- a/action.yml +++ b/action.yml @@ -13,8 +13,11 @@ inputs: If this is not given, the action will try and install the version specified in the `rust-toolchain` file. required: false - target: - description: Target triple to install for this toolchain + targets: + description: Comma-separated list of additional target triples to install for this toolchain + required: false + targets: + description: Alias for `targets` required: false default: description: Set installed toolchain as default diff --git a/src/args.ts b/src/args.ts index f89ed19..265f335 100644 --- a/src/args.ts +++ b/src/args.ts @@ -4,7 +4,7 @@ import { existsSync, readFileSync } from "fs"; export interface ToolchainOptions { name: string; - target: string | undefined; + targets: string | undefined; default: boolean; override: boolean; profile: string | undefined; @@ -41,9 +41,14 @@ export function getToolchainArgs(overrideFile: string): ToolchainOptions { components = undefined; } + let targets: string[] | undefined = input.getInputList("targets") || input.getInputList("target"); + if (targets && targets.length === 0) { + targets = undefined; + } + return { name: determineToolchain(overrideFile), - target: input.getInput("target") || undefined, + targets: targets, default: input.getInputBool("default"), override: input.getInputBool("override"), profile: input.getInput("profile") || undefined, diff --git a/src/main.ts b/src/main.ts index 9042876..dd37bca 100644 --- a/src/main.ts +++ b/src/main.ts @@ -79,8 +79,10 @@ async function run(): Promise { await rustup.installToolchain(opts.name, installOptions); - if (opts.target) { - await rustup.addTarget(opts.target, opts.name); + if (opts.targets) { + for (const target of opts.targets) { + await rustup.addTarget(target, opts.name); + } } await versions.gatherInstalledVersions();