-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathrun.ts
28 lines (24 loc) · 856 Bytes
/
run.ts
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
import * as core from '@actions/core';
import { getReleaseArtifact, setupArtifact } from './release';
import { validateMajorVersion } from './semver';
const inputNameVersion = 'version';
const inputNameSkipCache = 'skip-cache';
async function main() {
const version = core.getInput(inputNameVersion);
const skipCache = core.getInput(inputNameSkipCache) === 'true';
core.debug(`version: ${version} skip-cache: ${skipCache}`);
if (validateMajorVersion(version, '1')) {
const artifact = await getReleaseArtifact(version);
core.debug(`Resolved artifact: ${JSON.stringify(artifact)}`);
await setupArtifact(artifact, skipCache);
} else {
core.setFailed(
`Unsupported cli version ${version}. This action supports version ${1}`,
);
}
}
try {
main();
} catch (e) {
core.setFailed((e as { message: string }).message);
}