-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathindex.js
30 lines (23 loc) · 916 Bytes
/
index.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
const core = require('@actions/core');
const tc = require('@actions/tool-cache');
const { getDownloadObject } = require('./lib/utils');
async function setup() {
try {
// Get version of tool to be installed
const version = core.getInput('version');
console.log(`buildenv version to install: ${version}`);
// Download the specific version of the tool, e.g. as a tarball/zipball
const download = getDownloadObject(version);
const pathToTarball = await tc.downloadTool(download.url);
// Extract the tarball/zipball onto host runner
const cli_directory_path = await tc.extractTar(pathToTarball, download.binPath);
core.exportVariable('BUILDENV_CLI_PATH', download.toolPath);
core.addPath(cli_directory_path);
} catch (e) {
core.setFailed(e);
}
}
module.exports = setup
if (require.main === module) {
setup();
}