Skip to content

Commit

Permalink
Generate artifacts
Browse files Browse the repository at this point in the history
  • Loading branch information
Olafur Pall Geirsson committed Nov 27, 2019
1 parent a38b170 commit 49fc8c7
Show file tree
Hide file tree
Showing 219 changed files with 16,410 additions and 9 deletions.
9 changes: 0 additions & 9 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,7 +1,6 @@
__tests__/runner/*

# comment out in distribution branches
/node_modules/

# Rest pulled from https://github.com/github/gitignore/blob/master/Node.gitignore
# Logs
Expand All @@ -21,8 +20,6 @@ pids
*.seed
*.pid.lock

# Directory for instrumented libs generated by jscoverage/JSCover
lib-cov

# Coverage directory used by tools like istanbul
coverage
Expand All @@ -42,10 +39,8 @@ bower_components
# sbt specific
.cache
.history
.lib/
dist/*
target/
lib_managed/
src_managed/
project/boot/
project/plugins/project/
Expand All @@ -70,14 +65,10 @@ local.*

.DS_Store

node_modules

lib/core/metadata.js
lib/core/MetadataBlog.js

website/translated_docs
website/build/
website/yarn.lock
website/node_modules
website/i18n/*
!website/i18n/en.json
92 changes: 92 additions & 0 deletions lib/install.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,92 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
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) : adopt(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 shell = __importStar(require("shelljs"));
const path = __importStar(require("path"));
const homedir = require("os").homedir();
const bin = path.join(homedir, "bin");
function install(javaVersion, jabbaVersion) {
return __awaiter(this, void 0, void 0, function* () {
setEnvironmentVariableCI();
installJava(javaVersion, jabbaVersion);
installSbt();
});
}
exports.install = install;
function setEnvironmentVariableCI() {
core.exportVariable("CI", "true");
}
function jabbaUrlSuffix() {
const runnerOs = shell.env["RUNNER_OS"] || "undefined";
switch (runnerOs.toLowerCase()) {
case "linux":
return "linux-amd64";
case "macos":
return "darwin-amd64";
case "windows":
return "windows-amd64.exe";
default:
throw new Error(`unknown runner OS: ${runnerOs}, expected one of Linux, macOS or Windows.`);
}
}
function isWindows() {
return shell.env["RUNNER_OS"] === "Windows";
}
function jabbaName() {
if (isWindows())
return "jabba.exe";
else
return "jabba";
}
function installJava(javaVersion, jabbaVersion) {
core.startGroup("Install Java");
core.addPath(bin);
const jabbaUrl = `https://github.com/shyiko/jabba/releases/download/${jabbaVersion}/jabba-${jabbaVersion}-${jabbaUrlSuffix()}`;
shell.mkdir(bin);
const jabba = path.join(bin, jabbaName());
shell.set("-ev");
shell.exec(`curl -sL -o ${jabba} ${jabbaUrl}`, { silent: true });
shell.chmod(755, jabba);
const toInstall = shell
.exec(`${jabba} ls-remote`)
.grep(javaVersion)
.head({ "-n": 1 })
.stdout.trim();
console.log(`Installing ${toInstall}`);
shell.exec(`${jabba} install ${toInstall}`);
const javaHome = shell
.exec(`${jabba} which --home ${toInstall}`)
.stdout.trim();
core.exportVariable("JAVA_HOME", javaHome);
core.addPath(path.join(javaHome, "bin"));
core.endGroup();
}
function installSbt() {
core.startGroup("Install sbt");
core.addPath(bin);
curl("https://raw.githubusercontent.com/paulp/sbt-extras/master/sbt", path.join(bin, "sbt"));
curl("https://raw.githubusercontent.com/coursier/sbt-extras/master/sbt", path.join(bin, "csbt"));
core.endGroup();
}
function curl(url, outputFile) {
shell.exec(`curl -sL ${url}`, { silent: true }).to(outputFile);
shell.chmod(755, outputFile);
shell.cat(outputFile);
console.log(`Downloaded '${path.basename(outputFile)}' to ${outputFile}`);
}
34 changes: 34 additions & 0 deletions lib/main.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
"use strict";
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
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) : adopt(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 install_1 = require("./install");
function run() {
return __awaiter(this, void 0, void 0, function* () {
try {
const javaVersion = core.getInput("java-version", { required: true });
const jabbaVersion = core.getInput("jabba-version", { required: true });
console.log(`Installing Java version '${javaVersion}'`);
yield install_1.install(javaVersion, jabbaVersion);
}
catch (error) {
core.setFailed(error.message);
}
});
}
run();
1 change: 1 addition & 0 deletions node_modules/.bin/shjs

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

Loading

0 comments on commit 49fc8c7

Please sign in to comment.