Skip to content

Commit

Permalink
Bump @actions/* package versions
Browse files Browse the repository at this point in the history
Signed-off-by: Radu M <[email protected]>
  • Loading branch information
Radu M committed May 22, 2020
1 parent 25d4686 commit aff4ce7
Show file tree
Hide file tree
Showing 97 changed files with 9,489 additions and 2 deletions.
4 changes: 2 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ bower_components
build/Release

# Dependency directories
node_modules/
# node_modules/
jspm_packages/

# TypeScript v1 declaration files
Expand Down Expand Up @@ -90,5 +90,5 @@ typings/
# DynamoDB Local files
.dynamodb/

lib/
# lib/
test/tmp
108 changes: 108 additions & 0 deletions lib/configurator.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,108 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const tc = __importStar(require("@actions/tool-cache"));
const exec = __importStar(require("@actions/exec"));
const io = __importStar(require("@actions/io"));
const path = __importStar(require("path"));
const os = __importStar(require("os"));
var ArchiveType;
(function (ArchiveType) {
ArchiveType["None"] = "";
ArchiveType["TarGz"] = ".tar.gz";
ArchiveType["Zip"] = ".zip";
ArchiveType["SevenZ"] = ".7z";
})(ArchiveType = exports.ArchiveType || (exports.ArchiveType = {}));
class Configurator {
constructor(name, url, pathInArchive) {
this.name = name;
this.url = url;
this.pathInArchive = pathInArchive;
}
getArchiveType() {
if (this.url.endsWith(ArchiveType.TarGz))
return ArchiveType.TarGz;
if (this.url.endsWith(ArchiveType.Zip))
return ArchiveType.Zip;
if (this.url.endsWith(ArchiveType.SevenZ))
return ArchiveType.SevenZ;
return ArchiveType.None;
}
configure() {
return __awaiter(this, void 0, void 0, function* () {
console.log(`Downloading tool from ${this.url}...`);
let downloadPath = null;
let archivePath = null;
const tempDir = path.join(os.tmpdir(), 'tmp', 'runner', 'temp');
yield io.mkdirP(tempDir);
downloadPath = yield tc.downloadTool(this.url);
switch (this.getArchiveType()) {
case ArchiveType.None:
return this.moveToPath(downloadPath);
case ArchiveType.TarGz:
archivePath = yield tc.extractTar(downloadPath, tempDir);
return this.moveToPath(path.join(archivePath, this.pathInArchive));
case ArchiveType.Zip:
archivePath = yield tc.extractZip(downloadPath, tempDir);
return this.moveToPath(path.join(archivePath, this.pathInArchive));
case ArchiveType.SevenZ:
archivePath = yield tc.extract7z(downloadPath, tempDir);
return this.moveToPath(path.join(archivePath, this.pathInArchive));
}
});
}
moveToPath(downloadPath) {
return __awaiter(this, void 0, void 0, function* () {
let toolPath = binPath();
yield io.mkdirP(toolPath);
yield io.mv(downloadPath, path.join(toolPath, this.name));
if (process.platform !== 'win32') {
yield exec.exec("chmod", ["+x", path.join(toolPath, this.name)]);
}
core.addPath(toolPath);
});
}
}
exports.Configurator = Configurator;
const NameInput = "name";
const URLInput = "url";
const PathInArchiveInput = "pathInArchive";
function getConfig() {
const n = core.getInput(NameInput);
const u = core.getInput(URLInput);
const p = core.getInput(PathInArchiveInput);
return new Configurator(n, u, p);
}
exports.getConfig = getConfig;
function binPath() {
let baseLocation;
if (process.platform === 'win32') {
// On windows use the USERPROFILE env variable
baseLocation = process.env['USERPROFILE'] || 'C:\\';
}
else {
if (process.platform === 'darwin') {
baseLocation = '/Users';
}
else {
baseLocation = '/home';
}
}
return path.join(baseLocation, os.userInfo().username, "configurator", "bin");
}
exports.binPath = binPath;
31 changes: 31 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : new P(function (resolve) { resolve(result.value); }).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __importStar = (this && this.__importStar) || function (mod) {
if (mod && mod.__esModule) return mod;
var result = {};
if (mod != null) for (var k in mod) if (Object.hasOwnProperty.call(mod, k)) result[k] = mod[k];
result["default"] = mod;
return result;
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(require("@actions/core"));
const cfg = __importStar(require("./configurator"));
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
let c = cfg.getConfig();
yield c.configure();
}
catch (error) {
core.setFailed(error.message);
}
});
}
run();
1 change: 1 addition & 0 deletions node_modules/.bin/uuid

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

146 changes: 146 additions & 0 deletions node_modules/@actions/core/README.md

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

21 changes: 21 additions & 0 deletions node_modules/@actions/core/lib/command.d.ts

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading

0 comments on commit aff4ce7

Please sign in to comment.