Merge branch 'master' into peaceiris-patch-1

This commit is contained in:
Shohei Ueda 2019-11-22 11:14:59 +09:00 committed by GitHub
commit e785c1922d
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 82 additions and 28 deletions

View file

@ -5153,6 +5153,18 @@ const tc = __importStar(__webpack_require__(533));
const io = __importStar(__webpack_require__(1)); const io = __importStar(__webpack_require__(1));
const get_os_1 = __importDefault(__webpack_require__(443)); const get_os_1 = __importDefault(__webpack_require__(443));
const get_url_1 = __importDefault(__webpack_require__(901)); const get_url_1 = __importDefault(__webpack_require__(901));
const path = __importStar(__webpack_require__(622));
let tempDir = process.env['RUNNER_TEMPDIRECTORY'] || '';
if (!tempDir) {
let baseTempLocation;
if (process.platform === 'win32') {
baseTempLocation = process.env['USERPROFILE'] || 'C:\\';
}
else {
baseTempLocation = `${process.env.HOME}`;
}
tempDir = path.join(baseTempLocation, 'tmp');
}
function installer(version) { function installer(version) {
return __awaiter(this, void 0, void 0, function* () { return __awaiter(this, void 0, void 0, function* () {
try { try {
@ -5162,17 +5174,25 @@ function installer(version) {
console.log(`Operating System: ${osName}`); console.log(`Operating System: ${osName}`);
const hugoURL = get_url_1.default(osName, extended, version); const hugoURL = get_url_1.default(osName, extended, version);
core.debug(`hugoURL: ${hugoURL}`); core.debug(`hugoURL: ${hugoURL}`);
const hugoPath = `${process.env.HOME}/bin`; let baseLocation;
if (process.platform === 'win32') {
baseLocation = process.env['USERPROFILE'] || 'C:\\';
}
else {
baseLocation = `${process.env.HOME}`;
}
const hugoPath = path.join(baseLocation, 'hugobin');
yield io.mkdirP(hugoPath); yield io.mkdirP(hugoPath);
core.addPath(hugoPath); core.addPath(hugoPath);
yield io.mkdirP(tempDir);
const hugoAssets = yield tc.downloadTool(hugoURL); const hugoAssets = yield tc.downloadTool(hugoURL);
let hugoBin = ''; let hugoBin = '';
if (osName === 'Windows') { if (osName === 'Windows') {
const hugoExtractedFolder = yield tc.extractZip(hugoAssets, '/tmp'); const hugoExtractedFolder = yield tc.extractZip(hugoAssets, tempDir);
hugoBin = `${hugoExtractedFolder}/hugo.exe`; hugoBin = `${hugoExtractedFolder}/hugo.exe`;
} }
else { else {
const hugoExtractedFolder = yield tc.extractTar(hugoAssets, '/tmp'); const hugoExtractedFolder = yield tc.extractTar(hugoAssets, tempDir);
hugoBin = `${hugoExtractedFolder}/hugo`; hugoBin = `${hugoExtractedFolder}/hugo`;
} }
yield io.mv(hugoBin, hugoPath); yield io.mv(hugoBin, hugoPath);

53
package-lock.json generated
View file

@ -566,9 +566,9 @@
"dev": true "dev": true
}, },
"@types/node": { "@types/node": {
"version": "12.12.8", "version": "12.12.11",
"resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.8.tgz", "resolved": "https://registry.npmjs.org/@types/node/-/node-12.12.11.tgz",
"integrity": "sha512-XLla8N+iyfjvsa0KKV+BP/iGSoTmwxsu5Ci5sM33z9TjohF72DEz95iNvD6pPmemvbQgxAv/909G73gUn8QR7w==", "integrity": "sha512-O+x6uIpa6oMNTkPuHDa9MhMMehlxLAd5QcOvKRjAFsBVpeFWTOPnXbDvILvFgFFZfQ1xh1EZi1FbXxUix+zpsQ==",
"dev": true "dev": true
}, },
"@types/normalize-package-data": { "@types/normalize-package-data": {
@ -599,36 +599,37 @@
"dev": true "dev": true
}, },
"@typescript-eslint/experimental-utils": { "@typescript-eslint/experimental-utils": {
"version": "2.7.0", "version": "2.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.7.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/experimental-utils/-/experimental-utils-2.8.0.tgz",
"integrity": "sha512-9/L/OJh2a5G2ltgBWJpHRfGnt61AgDeH6rsdg59BH0naQseSwR7abwHq3D5/op0KYD/zFT4LS5gGvWcMmegTEg==", "integrity": "sha512-jZ05E4SxCbbXseQGXOKf3ESKcsGxT8Ucpkp1jiVp55MGhOvZB2twmWKf894PAuVQTCgbPbJz9ZbRDqtUWzP8xA==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/json-schema": "^7.0.3", "@types/json-schema": "^7.0.3",
"@typescript-eslint/typescript-estree": "2.7.0", "@typescript-eslint/typescript-estree": "2.8.0",
"eslint-scope": "^5.0.0" "eslint-scope": "^5.0.0"
} }
}, },
"@typescript-eslint/parser": { "@typescript-eslint/parser": {
"version": "2.7.0", "version": "2.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.7.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/parser/-/parser-2.8.0.tgz",
"integrity": "sha512-ctC0g0ZvYclxMh/xI+tyqP0EC2fAo6KicN9Wm2EIao+8OppLfxji7KAGJosQHSGBj3TcqUrA96AjgXuKa5ob2g==", "integrity": "sha512-NseXWzhkucq+JM2HgqAAoKEzGQMb5LuTRjFPLQzGIdLthXMNUfuiskbl7QSykvWW6mvzCtYbw1fYWGa2EIaekw==",
"dev": true, "dev": true,
"requires": { "requires": {
"@types/eslint-visitor-keys": "^1.0.0", "@types/eslint-visitor-keys": "^1.0.0",
"@typescript-eslint/experimental-utils": "2.7.0", "@typescript-eslint/experimental-utils": "2.8.0",
"@typescript-eslint/typescript-estree": "2.7.0", "@typescript-eslint/typescript-estree": "2.8.0",
"eslint-visitor-keys": "^1.1.0" "eslint-visitor-keys": "^1.1.0"
} }
}, },
"@typescript-eslint/typescript-estree": { "@typescript-eslint/typescript-estree": {
"version": "2.7.0", "version": "2.8.0",
"resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.7.0.tgz", "resolved": "https://registry.npmjs.org/@typescript-eslint/typescript-estree/-/typescript-estree-2.8.0.tgz",
"integrity": "sha512-vVCE/DY72N4RiJ/2f10PTyYekX2OLaltuSIBqeHYI44GQ940VCYioInIb8jKMrK9u855OEJdFC+HmWAZTnC+Ag==", "integrity": "sha512-ksvjBDTdbAQ04cR5JyFSDX113k66FxH1tAXmi+dj6hufsl/G0eMc/f1GgLjEVPkYClDbRKv+rnBFuE5EusomUw==",
"dev": true, "dev": true,
"requires": { "requires": {
"debug": "^4.1.1", "debug": "^4.1.1",
"glob": "^7.1.4", "eslint-visitor-keys": "^1.1.0",
"glob": "^7.1.6",
"is-glob": "^4.0.1", "is-glob": "^4.0.1",
"lodash.unescape": "4.0.1", "lodash.unescape": "4.0.1",
"semver": "^6.3.0", "semver": "^6.3.0",
@ -644,6 +645,20 @@
"ms": "^2.1.1" "ms": "^2.1.1"
} }
}, },
"glob": {
"version": "7.1.6",
"resolved": "https://registry.npmjs.org/glob/-/glob-7.1.6.tgz",
"integrity": "sha512-LwaxwyZ72Lk7vZINtNNrywX0ZuLyStrdDtabefZKAY5ZGJhVtgdznluResxNmPitE0SAO+O26sWTHeKSI2wMBA==",
"dev": true,
"requires": {
"fs.realpath": "^1.0.0",
"inflight": "^1.0.4",
"inherits": "2",
"minimatch": "^3.0.4",
"once": "^1.3.0",
"path-is-absolute": "^1.0.0"
}
},
"ms": { "ms": {
"version": "2.1.2", "version": "2.1.2",
"resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz", "resolved": "https://registry.npmjs.org/ms/-/ms-2.1.2.tgz",
@ -3045,9 +3060,9 @@
} }
}, },
"husky": { "husky": {
"version": "3.0.9", "version": "3.1.0",
"resolved": "https://registry.npmjs.org/husky/-/husky-3.0.9.tgz", "resolved": "https://registry.npmjs.org/husky/-/husky-3.1.0.tgz",
"integrity": "sha512-Yolhupm7le2/MqC1VYLk/cNmYxsSsqKkTyBhzQHhPK1jFnC89mmmNVuGtLNabjDI6Aj8UNIr0KpRNuBkiC4+sg==", "integrity": "sha512-FJkPoHHB+6s4a+jwPqBudBDvYZsoQW5/HBuMSehC8qDiCe50kpcxeqFoDSlow+9I6wg47YxBoT3WxaURlrDIIQ==",
"dev": true, "dev": true,
"requires": { "requires": {
"chalk": "^2.4.2", "chalk": "^2.4.2",

View file

@ -54,11 +54,11 @@
}, },
"devDependencies": { "devDependencies": {
"@types/jest": "^24.0.23", "@types/jest": "^24.0.23",
"@types/node": "^12.12.8", "@types/node": "^12.12.11",
"@typescript-eslint/parser": "^2.7.0", "@typescript-eslint/parser": "^2.8.0",
"@zeit/ncc": "^0.20.5", "@zeit/ncc": "^0.20.5",
"eslint": "^6.6.0", "eslint": "^6.6.0",
"husky": "^3.0.9", "husky": "^3.1.0",
"jest": "^24.9.0", "jest": "^24.9.0",
"jest-circus": "^24.9.0", "jest-circus": "^24.9.0",
"lint-staged": "^9.4.3", "lint-staged": "^9.4.3",

View file

@ -3,6 +3,18 @@ import * as tc from '@actions/tool-cache';
import * as io from '@actions/io'; import * as io from '@actions/io';
import getOS from './get-os'; import getOS from './get-os';
import getURL from './get-url'; import getURL from './get-url';
import * as path from 'path';
let tempDir: string = process.env['RUNNER_TEMPDIRECTORY'] || '';
if (!tempDir) {
let baseTempLocation: string;
if (process.platform === 'win32') {
baseTempLocation = process.env['USERPROFILE'] || 'C:\\';
} else {
baseTempLocation = `${process.env.HOME}`;
}
tempDir = path.join(baseTempLocation, 'tmp');
}
export default async function installer(version: string) { export default async function installer(version: string) {
try { try {
@ -15,23 +27,30 @@ export default async function installer(version: string) {
const hugoURL: string = getURL(osName, extended, version); const hugoURL: string = getURL(osName, extended, version);
core.debug(`hugoURL: ${hugoURL}`); core.debug(`hugoURL: ${hugoURL}`);
const hugoPath: string = `${process.env.HOME}/bin`; let baseLocation: string;
if (process.platform === 'win32') {
baseLocation = process.env['USERPROFILE'] || 'C:\\';
} else {
baseLocation = `${process.env.HOME}`;
}
const hugoPath: string = path.join(baseLocation, 'hugobin');
await io.mkdirP(hugoPath); await io.mkdirP(hugoPath);
core.addPath(hugoPath); core.addPath(hugoPath);
// Download and extract Hugo binary // Download and extract Hugo binary
await io.mkdirP(tempDir);
const hugoAssets: string = await tc.downloadTool(hugoURL); const hugoAssets: string = await tc.downloadTool(hugoURL);
let hugoBin: string = ''; let hugoBin: string = '';
if (osName === 'Windows') { if (osName === 'Windows') {
const hugoExtractedFolder: string = await tc.extractZip( const hugoExtractedFolder: string = await tc.extractZip(
hugoAssets, hugoAssets,
'/tmp' tempDir
); );
hugoBin = `${hugoExtractedFolder}/hugo.exe`; hugoBin = `${hugoExtractedFolder}/hugo.exe`;
} else { } else {
const hugoExtractedFolder: string = await tc.extractTar( const hugoExtractedFolder: string = await tc.extractTar(
hugoAssets, hugoAssets,
'/tmp' tempDir
); );
hugoBin = `${hugoExtractedFolder}/hugo`; hugoBin = `${hugoExtractedFolder}/hugo`;
} }