reindent
This commit is contained in:
parent
053422e2e1
commit
b836447fac
1 changed files with 27 additions and 28 deletions
55
index.js
55
index.js
|
@ -7,40 +7,39 @@ const getLatestVersion = require("./get-latest-version");
|
|||
// most @actions toolkit packages have async methods
|
||||
async function run() {
|
||||
try {
|
||||
let hugoVersion = core.getInput("hugo-version");
|
||||
if (!hugoVersion || hugoVersion === "latest") {
|
||||
hugoVersion = "0.58.2";
|
||||
getLatestVersion().then(function(version) {
|
||||
console.log(version);
|
||||
});
|
||||
}
|
||||
core.debug(`Hugo version: ${hugoVersion}`);
|
||||
getLatestVersion().then(function(latestVersion) {
|
||||
let hugoVersion = core.getInput("hugo-version");
|
||||
if (!hugoVersion || hugoVersion === "latest") {
|
||||
hugoVersion = latestVersion;
|
||||
}
|
||||
core.debug(`Hugo version: ${hugoVersion}`);
|
||||
|
||||
let extended = core.getInput("extended");
|
||||
if (!extended) {
|
||||
extended = false;
|
||||
}
|
||||
core.debug(`Hugo extended: ${extended}`);
|
||||
let extended = core.getInput("extended");
|
||||
if (!extended) {
|
||||
extended = false;
|
||||
}
|
||||
core.debug(`Hugo extended: ${extended}`);
|
||||
|
||||
let extendedStr = "";
|
||||
if (extended) {
|
||||
extendedStr = "extended_";
|
||||
}
|
||||
let extendedStr = "";
|
||||
if (extended) {
|
||||
extendedStr = "extended_";
|
||||
}
|
||||
|
||||
const hugoName = `hugo_${extendedStr}${hugoVersion}_Linux-64bit`;
|
||||
core.debug(`hugoName: ${hugoName}`);
|
||||
const hugoName = `hugo_${extendedStr}${hugoVersion}_Linux-64bit`;
|
||||
core.debug(`hugoName: ${hugoName}`);
|
||||
|
||||
const hugoURL = `https://github.com/gohugoio/hugo/releases/download/v${hugoVersion}/${hugoName}.tar.gz`;
|
||||
core.debug(`hugoURL: ${hugoURL}`);
|
||||
const hugoURL = `https://github.com/gohugoio/hugo/releases/download/v${hugoVersion}/${hugoName}.tar.gz`;
|
||||
core.debug(`hugoURL: ${hugoURL}`);
|
||||
|
||||
const hugoPath = "/usr/local/bin";
|
||||
await io.mkdirP(hugoPath);
|
||||
const hugoPath = "/usr/local/bin";
|
||||
await io.mkdirP(hugoPath);
|
||||
|
||||
// Download and extract Hugo binary
|
||||
const hugoTarball = await tc.downloadTool(hugoURL);
|
||||
const hugoExtractedFolder = await tc.extractTar(hugoTarball, "/tmp");
|
||||
core.debug("hugoExtractedFolder:", hugoExtractedFolder);
|
||||
await exec.exec("sudo", ["mv", `${hugoExtractedFolder}/hugo`, hugoPath]);
|
||||
// Download and extract Hugo binary
|
||||
const hugoTarball = await tc.downloadTool(hugoURL);
|
||||
const hugoExtractedFolder = await tc.extractTar(hugoTarball, "/tmp");
|
||||
core.debug("hugoExtractedFolder:", hugoExtractedFolder);
|
||||
await exec.exec("sudo", ["mv", `${hugoExtractedFolder}/hugo`, hugoPath]);
|
||||
});
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue