generated from actions/javascript-action
-
Notifications
You must be signed in to change notification settings - Fork 1
/
index.js
24 lines (19 loc) · 835 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
const core = require('@actions/core');
const tc = require('@actions/tool-cache');
async function run() {
try {
const taskVersion = core.getInput('task-version');
const dlUrl = `https://github.com/go-task/task/releases/download/v${taskVersion}/task_linux_amd64.tar.gz`;
core.info(`Downloading go-task/task version ${taskVersion} from ${dlUrl}`)
const taskDlPath = await tc.downloadTool(dlUrl);
const extractedFolder = await tc.extractTar(taskDlPath);
core.debug(`Extracted go-task/task to ${extractedFolder}`);
const cachedPath = await tc.cacheDir(extractedFolder, "task", taskVersion);
core.debug(`cache-path ${cachedPath}`);
core.addPath(cachedPath);
} catch (error) {
core.setFailed(error.message);
}
}
run()
.catch(console.error);