Add components
support as an input
This commit is contained in:
@@ -22,10 +22,17 @@ function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const version = core.getInput('rust-version');
|
||||
const components = core.getInput('components')
|
||||
.split(',')
|
||||
.map((component) => component.trim())
|
||||
.filter((component) => component.length > 0);
|
||||
if (version) {
|
||||
yield rustup.install(version);
|
||||
yield rustup.install();
|
||||
yield exec.exec('rustup', ['default', version]);
|
||||
yield exec.exec('rustup', ['update', version]);
|
||||
for (let component of components) {
|
||||
yield exec.exec('rustup', ['component', 'add', component]);
|
||||
}
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
|
@@ -22,29 +22,22 @@ const path = __importStar(require("path"));
|
||||
const os = __importStar(require("os"));
|
||||
const fs_1 = require("fs");
|
||||
let tempDirectory = process.env['RUNNER_TEMPDIRECTORY'] || '';
|
||||
function install(version) {
|
||||
function install() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
// `rustup` is already installed on Linux and Windows platforms
|
||||
if (os.platform() == 'darwin') {
|
||||
let toolPath = yield acquireRust(version);
|
||||
core.debug('Rust toolchain is cached under ' + toolPath);
|
||||
let toolPath = yield installOnUnix();
|
||||
core.debug('rustup is located under: ' + toolPath);
|
||||
core.addPath(path.join(toolPath, 'bin'));
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.install = install;
|
||||
function acquireRust(version) {
|
||||
function installOnUnix() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
let script;
|
||||
try {
|
||||
script = yield toolCache.downloadTool("https://sh.rustup.rs");
|
||||
}
|
||||
catch (error) {
|
||||
core.debug(error);
|
||||
throw `Failed to download rustup: ${error}`;
|
||||
}
|
||||
let script = yield toolCache.downloadTool("https://sh.rustup.rs");
|
||||
fs_1.chmodSync(script, '777');
|
||||
yield exec.exec(`"${script}"`, ['-y', '--default-toolchain', 'none']);
|
||||
let cargo = path.join(process.env['HOME'] || '', '.cargo');
|
||||
return yield toolCache.cacheDir(cargo, 'rust', version);
|
||||
return path.join(process.env['HOME'] || '', '.cargo');
|
||||
});
|
||||
}
|
||||
|
Reference in New Issue
Block a user