Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Pull in v1 changes #9

Closed
wants to merge 20 commits into from
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
Release
  • Loading branch information
LPGhatguy committed Feb 25, 2020
commit 9edbb25abe663f93fac0c8d66ebabaf3edc85482
30 changes: 24 additions & 6 deletions dist/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -5444,6 +5444,7 @@ function run() {
if (process.platform === "darwin" || process.platform === "linux") {
yield exec_1.exec("chmod +x .foreman-install/foreman");
}
yield foreman_1.default.authenticate(githubToken);
foreman_1.default.addBinDirToPath();
}
catch (error) {
Expand Down Expand Up @@ -9465,6 +9466,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
};
Object.defineProperty(exports, "__esModule", { value: true });
const core = __importStar(__webpack_require__(470));
const exec_1 = __webpack_require__(986);
const semver_1 = __importDefault(__webpack_require__(876));
function getReleases(octokit) {
return __awaiter(this, void 0, void 0, function* () {
Expand All @@ -9486,33 +9488,49 @@ function chooseRelease(versionReq, releases) {
return null;
}
function chooseAsset(release) {
let platformName;
let platformMatcher;
if (process.platform === "win32") {
platformName = "windows";
platformMatcher = name => name.includes("windows") ||
name.includes("win64") ||
name.includes("win32");
}
else if (process.platform === "darwin") {
platformName = "macos";
platformMatcher = name => name.includes("macos");
}
else if (process.platform === "linux") {
platformName = "linux";
platformMatcher = name => name.includes("linux");
}
else {
throw new Error(`Unsupported platform "${process.platform}"`);
}
for (const asset of release.assets) {
if (asset.name.includes(platformName)) {
if (platformMatcher(asset.name)) {
return asset;
}
}
return null;
}
function authenticate(token) {
return __awaiter(this, void 0, void 0, function* () {
yield exec_1.exec("foreman", ["github-auth", token]);
});
}
function addBinDirToPath() {
core.addPath("~/.foreman/bin");
if (process.platform === "win32") {
core.addPath(`${process.env.USERPROFILE}\\.foreman\\bin`);
}
else if (process.platform === "darwin" || process.platform === "linux") {
core.addPath("~/.foreman/bin");
}
else {
throw new Error(`Unsupported platform "${process.platform}"`);
}
}
exports.default = {
getReleases,
chooseRelease,
chooseAsset,
authenticate,
addBinDirToPath
};

Expand Down