Skip to content

Commit aff4ce7

Browse files
author
Radu M
committed
Bump @actions/* package versions
Signed-off-by: Radu M <root@radu.sh>
1 parent 25d4686 commit aff4ce7

97 files changed

Lines changed: 9489 additions & 2 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

.gitignore

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ bower_components
4141
build/Release
4242

4343
# Dependency directories
44-
node_modules/
44+
# node_modules/
4545
jspm_packages/
4646

4747
# TypeScript v1 declaration files
@@ -90,5 +90,5 @@ typings/
9090
# DynamoDB Local files
9191
.dynamodb/
9292

93-
lib/
93+
# lib/
9494
test/tmp

lib/configurator.js

Lines changed: 108 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,108 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
return new (P || (P = Promise))(function (resolve, reject) {
4+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
7+
step((generator = generator.apply(thisArg, _arguments || [])).next());
8+
});
9+
};
10+
var __importStar = (this && this.__importStar) || function (mod) {
11+
if (mod && mod.__esModule) return mod;
12+
var result = {};
13+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
14+
result["default"] = mod;
15+
return result;
16+
};
17+
Object.defineProperty(exports, "__esModule", { value: true });
18+
const core = __importStar(require("@actions/core"));
19+
const tc = __importStar(require("@actions/tool-cache"));
20+
const exec = __importStar(require("@actions/exec"));
21+
const io = __importStar(require("@actions/io"));
22+
const path = __importStar(require("path"));
23+
const os = __importStar(require("os"));
24+
var ArchiveType;
25+
(function (ArchiveType) {
26+
ArchiveType["None"] = "";
27+
ArchiveType["TarGz"] = ".tar.gz";
28+
ArchiveType["Zip"] = ".zip";
29+
ArchiveType["SevenZ"] = ".7z";
30+
})(ArchiveType = exports.ArchiveType || (exports.ArchiveType = {}));
31+
class Configurator {
32+
constructor(name, url, pathInArchive) {
33+
this.name = name;
34+
this.url = url;
35+
this.pathInArchive = pathInArchive;
36+
}
37+
getArchiveType() {
38+
if (this.url.endsWith(ArchiveType.TarGz))
39+
return ArchiveType.TarGz;
40+
if (this.url.endsWith(ArchiveType.Zip))
41+
return ArchiveType.Zip;
42+
if (this.url.endsWith(ArchiveType.SevenZ))
43+
return ArchiveType.SevenZ;
44+
return ArchiveType.None;
45+
}
46+
configure() {
47+
return __awaiter(this, void 0, void 0, function* () {
48+
console.log(`Downloading tool from ${this.url}...`);
49+
let downloadPath = null;
50+
let archivePath = null;
51+
const tempDir = path.join(os.tmpdir(), 'tmp', 'runner', 'temp');
52+
yield io.mkdirP(tempDir);
53+
downloadPath = yield tc.downloadTool(this.url);
54+
switch (this.getArchiveType()) {
55+
case ArchiveType.None:
56+
return this.moveToPath(downloadPath);
57+
case ArchiveType.TarGz:
58+
archivePath = yield tc.extractTar(downloadPath, tempDir);
59+
return this.moveToPath(path.join(archivePath, this.pathInArchive));
60+
case ArchiveType.Zip:
61+
archivePath = yield tc.extractZip(downloadPath, tempDir);
62+
return this.moveToPath(path.join(archivePath, this.pathInArchive));
63+
case ArchiveType.SevenZ:
64+
archivePath = yield tc.extract7z(downloadPath, tempDir);
65+
return this.moveToPath(path.join(archivePath, this.pathInArchive));
66+
}
67+
});
68+
}
69+
moveToPath(downloadPath) {
70+
return __awaiter(this, void 0, void 0, function* () {
71+
let toolPath = binPath();
72+
yield io.mkdirP(toolPath);
73+
yield io.mv(downloadPath, path.join(toolPath, this.name));
74+
if (process.platform !== 'win32') {
75+
yield exec.exec("chmod", ["+x", path.join(toolPath, this.name)]);
76+
}
77+
core.addPath(toolPath);
78+
});
79+
}
80+
}
81+
exports.Configurator = Configurator;
82+
const NameInput = "name";
83+
const URLInput = "url";
84+
const PathInArchiveInput = "pathInArchive";
85+
function getConfig() {
86+
const n = core.getInput(NameInput);
87+
const u = core.getInput(URLInput);
88+
const p = core.getInput(PathInArchiveInput);
89+
return new Configurator(n, u, p);
90+
}
91+
exports.getConfig = getConfig;
92+
function binPath() {
93+
let baseLocation;
94+
if (process.platform === 'win32') {
95+
// On windows use the USERPROFILE env variable
96+
baseLocation = process.env['USERPROFILE'] || 'C:\\';
97+
}
98+
else {
99+
if (process.platform === 'darwin') {
100+
baseLocation = '/Users';
101+
}
102+
else {
103+
baseLocation = '/home';
104+
}
105+
}
106+
return path.join(baseLocation, os.userInfo().username, "configurator", "bin");
107+
}
108+
exports.binPath = binPath;

lib/main.js

Lines changed: 31 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,31 @@
1+
"use strict";
2+
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
3+
return new (P || (P = Promise))(function (resolve, reject) {
4+
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
5+
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
6+
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
7+
step((generator = generator.apply(thisArg, _arguments || [])).next());
8+
});
9+
};
10+
var __importStar = (this && this.__importStar) || function (mod) {
11+
if (mod && mod.__esModule) return mod;
12+
var result = {};
13+
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
14+
result["default"] = mod;
15+
return result;
16+
};
17+
Object.defineProperty(exports, "__esModule", { value: true });
18+
const core = __importStar(require("@actions/core"));
19+
const cfg = __importStar(require("./configurator"));
20+
function run() {
21+
return __awaiter(this, void 0, void 0, function* () {
22+
try {
23+
let c = cfg.getConfig();
24+
yield c.configure();
25+
}
26+
catch (error) {
27+
core.setFailed(error.message);
28+
}
29+
});
30+
}
31+
run();

node_modules/.bin/uuid

Lines changed: 1 addition & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/README.md

Lines changed: 146 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

node_modules/@actions/core/lib/command.d.ts

Lines changed: 21 additions & 0 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)