setup-rust-action/src/main.ts

21 lines
463 B
TypeScript
Raw Normal View History

2019-08-15 17:16:59 +00:00
import * as core from '@actions/core';
2019-08-15 21:22:17 +00:00
import * as exec from '@actions/exec';
2019-08-15 18:12:08 +00:00
import * as rustup from './rustup';
import * as os from 'os';
2019-08-15 17:16:59 +00:00
async function run() {
try {
2019-08-15 18:12:08 +00:00
const version = core.getInput('rust-version');
2019-08-15 20:54:23 +00:00
if(version) {
2019-08-15 18:12:08 +00:00
await rustup.install(version);
2019-08-15 21:32:28 +00:00
await exec.exec('rustup', ['default', version]);
await exec.exec('rustup', ['update', version]);
2019-08-15 18:12:08 +00:00
}
2019-08-15 17:16:59 +00:00
} catch (error) {
core.setFailed(error.message);
}
}
run();