mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2026-01-25 20:32:19 +01:00
Compare commits
43 Commits
v2.0.0-rc1
...
v2.2.2
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64951c5a73 | ||
|
|
35c74b6a6a | ||
|
|
b5fb138703 | ||
|
|
6f6a564fad | ||
|
|
cd3751ce70 | ||
|
|
07e434d37c | ||
|
|
1405de8b20 | ||
|
|
7346c7bdad | ||
|
|
f1ac6bf271 | ||
|
|
c7b570bed5 | ||
|
|
3ae7dd1270 | ||
|
|
9fdb1cb749 | ||
|
|
e2b52b7b4d | ||
|
|
8e97852759 | ||
|
|
b46070141b | ||
|
|
a1adb3bb7b | ||
|
|
fbb67a3359 | ||
|
|
2e5b1b84d6 | ||
|
|
6d819cab4c | ||
|
|
a6d33f08ac | ||
|
|
71663ea875 | ||
|
|
d7d48e3009 | ||
|
|
39aa1b7d04 | ||
|
|
b10091c0dc | ||
|
|
824187d952 | ||
|
|
e194c83989 | ||
|
|
c3970dfbdd | ||
|
|
082748017c | ||
|
|
79d6bc5f6e | ||
|
|
8f1aef7e73 | ||
|
|
dc8541739a | ||
|
|
4d54b90c0e | ||
|
|
25a3456032 | ||
|
|
4f371785be | ||
|
|
3bbd6d1917 | ||
|
|
d46d0aa12e | ||
|
|
85171ece4e | ||
|
|
624c2a083b | ||
|
|
7a9975a8b1 | ||
|
|
c635fd9746 | ||
|
|
19661a5c56 | ||
|
|
c4f3b85a0d | ||
|
|
68358aa004 |
9
.editorconfig
Normal file
9
.editorconfig
Normal file
@@ -0,0 +1,9 @@
|
||||
root = true
|
||||
|
||||
[*]
|
||||
charset = utf-8
|
||||
end_of_line = lf
|
||||
indent_size = 2
|
||||
indent_style = space
|
||||
insert_final_newline = true
|
||||
trim_trailing_whitespace = true
|
||||
@@ -9,8 +9,10 @@
|
||||
"Atomics": "readonly",
|
||||
"SharedArrayBuffer": "readonly"
|
||||
},
|
||||
"parser": "@typescript-eslint/parser",
|
||||
"parserOptions": {
|
||||
"ecmaVersion": 2018
|
||||
"sourceType": "module",
|
||||
"ecmaVersion": 2019
|
||||
},
|
||||
"rules": {
|
||||
}
|
||||
|
||||
48
.github/workflows/test.yml
vendored
48
.github/workflows/test.yml
vendored
@@ -1,6 +1,11 @@
|
||||
name: 'Test'
|
||||
|
||||
on: push
|
||||
on:
|
||||
pull_request:
|
||||
types: [opened, synchronize]
|
||||
push:
|
||||
branches:
|
||||
- master
|
||||
|
||||
jobs:
|
||||
test:
|
||||
@@ -8,41 +13,50 @@ jobs:
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Install dependencies
|
||||
run: npm ci
|
||||
|
||||
- name: Format check
|
||||
run: npm run format:check
|
||||
|
||||
- name: Lint
|
||||
run: npm run lint
|
||||
|
||||
# - name: Test script
|
||||
# run: npm test
|
||||
- name: Test
|
||||
run: npm test
|
||||
|
||||
- name: Build production
|
||||
run: npm run build
|
||||
- uses: actions/upload-artifact@master
|
||||
with:
|
||||
name: coverage
|
||||
path: coverage
|
||||
|
||||
|
||||
test-prod:
|
||||
runs-on: ubuntu-18.04
|
||||
|
||||
runs-on: ${{ matrix.os }}
|
||||
needs: test
|
||||
strategy:
|
||||
matrix:
|
||||
hugo-version: [null]
|
||||
# hugo-version: [null, 'latest', '0.58.2']
|
||||
extended: [null]
|
||||
# extended: [null, true, false]
|
||||
os: ['ubuntu-18.04', 'macOS-10.14', 'windows-2019']
|
||||
hugo-version: ['latest', '0.57.2']
|
||||
extended: [true, false]
|
||||
# exclude:
|
||||
# - os: 'macOS-10.14'
|
||||
# hugo-version: 'latest'
|
||||
# extended: false
|
||||
# - os: 'windows-2019'
|
||||
# hugo-version: 'latest'
|
||||
# extended: false
|
||||
|
||||
steps:
|
||||
- uses: actions/checkout@v1
|
||||
with:
|
||||
fetch-depth: 1
|
||||
|
||||
- name: Test action
|
||||
uses: ./
|
||||
with:
|
||||
hugo-version: ${{ matrix.hugo-version }}
|
||||
extended: ${{ matrix.extended }}
|
||||
|
||||
- name: Dump
|
||||
run: |
|
||||
hugo version
|
||||
go version
|
||||
git --version
|
||||
|
||||
11
.prettierrc.json
Normal file
11
.prettierrc.json
Normal file
@@ -0,0 +1,11 @@
|
||||
{
|
||||
"printWidth": 80,
|
||||
"tabWidth": 2,
|
||||
"useTabs": false,
|
||||
"semi": true,
|
||||
"singleQuote": true,
|
||||
"trailingComma": "none",
|
||||
"bracketSpacing": false,
|
||||
"arrowParens": "avoid",
|
||||
"parser": "typescript"
|
||||
}
|
||||
3
.vscode/settings.json
vendored
Normal file
3
.vscode/settings.json
vendored
Normal file
@@ -0,0 +1,3 @@
|
||||
{
|
||||
"git.ignoreLimitWarning": true
|
||||
}
|
||||
61
README.md
61
README.md
@@ -1,7 +1,7 @@
|
||||
[](https://github.com/peaceiris/actions-hugo/blob/master/LICENSE)
|
||||
[](https://github.com/peaceiris/actions-hugo/releases/latest)
|
||||
[](https://github.com/peaceiris/actions-hugo/releases)
|
||||
[](https://github.com/peaceiris/actions-hugo/actions)
|
||||
[](https://github.com/peaceiris/actions-hugo/actions)
|
||||
|
||||
<img width="400" alt="GitHub Actions for Hugo" src="./images/ogp.svg">
|
||||
|
||||
@@ -11,13 +11,39 @@
|
||||
|
||||
- [gohugoio/hugo: The world’s fastest framework for building websites.](https://github.com/gohugoio/hugo)
|
||||
|
||||
We can run Hugo on a virtual machine of GitHub Actions by this Hugo action. Hugo extended version and Hugo Modules are supported.
|
||||
|
||||
From `v2.0.0`, this Hugo action migrated to a JavaScript (TypeScript) action. We no longer build or pull a Hugo docker image. Thanks to this change, we can complete this action less than **4 sec**. (A docker base action was taking about 1 min or more execution time to build or pull.)
|
||||
|
||||
| OS (runs-on) | ubuntu-18.04 | macOS-10.14 | windows-2019 |
|
||||
|---|:---:|:---:|:---:|
|
||||
| Support | ✅️ | ✅️ | ✅️ |
|
||||
|
||||
| Hugo type | Hugo Extended | Hugo Modules | Latest Hugo |
|
||||
|---|:---:|:---:|:---:|
|
||||
| Support | ✅️ | ✅️ | ✅️ |
|
||||
|
||||
<!-- START doctoc generated TOC please keep comment here to allow auto update -->
|
||||
<!-- DON'T EDIT THIS SECTION, INSTEAD RE-RUN doctoc TO UPDATE -->
|
||||
*Table of Contents*
|
||||
|
||||
- [Getting started](#getting-started)
|
||||
- [⭐️ Create your workflow](#%EF%B8%8F-create-your-workflow)
|
||||
- [Options](#options)
|
||||
- [⭐️ Use Hugo extended](#%EF%B8%8F-use-hugo-extended)
|
||||
- [⭐️ Use the latest version of Hugo](#%EF%B8%8F-use-the-latest-version-of-hugo)
|
||||
- [License](#license)
|
||||
- [About the author](#about-the-author)
|
||||
|
||||
<!-- END doctoc generated TOC please keep comment here to allow auto update -->
|
||||
|
||||
|
||||
|
||||
## Getting started
|
||||
|
||||
### Create `.github/workflows/gh-pages.yml`
|
||||
### ⭐️ Create your workflow
|
||||
|
||||
An example workflow with [GitHub Actions for deploying to GitHub Pages with Static Site Generators]
|
||||
An example workflow `.github/workflows/gh-pages.yml` with [GitHub Actions for deploying to GitHub Pages with Static Site Generators]
|
||||
|
||||
[GitHub Actions for deploying to GitHub Pages with Static Site Generators]: https://github.com/peaceiris/actions-gh-pages
|
||||
|
||||
@@ -37,19 +63,24 @@ on:
|
||||
jobs:
|
||||
build-deploy:
|
||||
runs-on: ubuntu-18.04
|
||||
# runs-on: macOS-10.14
|
||||
# runs-on: windows-2019
|
||||
steps:
|
||||
- uses: actions/checkout@master
|
||||
# with:
|
||||
# submodules: true
|
||||
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2.0.0
|
||||
uses: peaceiris/actions-hugo@v2.2.1
|
||||
with:
|
||||
hugo-version: '0.58.2'
|
||||
hugo-version: '0.58.3'
|
||||
# extended: true
|
||||
|
||||
- name: Build
|
||||
run: hugo --gc --minify --cleanDestinationDir
|
||||
|
||||
- name: Deploy
|
||||
uses: peaceiris/actions-gh-pages@v2.3.1
|
||||
uses: peaceiris/actions-gh-pages@v2.5.0
|
||||
env:
|
||||
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||
PUBLISH_BRANCH: gh-pages
|
||||
@@ -60,28 +91,30 @@ jobs:
|
||||
|
||||
## Options
|
||||
|
||||
### Hugo extended
|
||||
### ⭐️ Use Hugo extended
|
||||
|
||||
Set `extended: true` to use a Hugo extended version.
|
||||
|
||||
```yaml
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2.0.0
|
||||
uses: peaceiris/actions-hugo@v2.2.1
|
||||
with:
|
||||
hugo-version: '0.58.2'
|
||||
hugo-version: '0.58.3'
|
||||
extended: true
|
||||
```
|
||||
|
||||
### Latest version of Hugo
|
||||
### ⭐️ Use the latest version of Hugo
|
||||
|
||||
Set `hugo-version: 'latest'` to use the latest version of Hugo.
|
||||
|
||||
```yaml
|
||||
- name: Setup Hugo
|
||||
uses: peaceiris/actions-hugo@v2.0.0
|
||||
uses: peaceiris/actions-hugo@v2.2.1
|
||||
with:
|
||||
hugo-version: 'latest'
|
||||
```
|
||||
|
||||
**Note**: This action gets a Hugo latest version by GitHub API. Please be aware of [GitHub API Rate limiting]
|
||||
|
||||
[GitHub API Rate limiting]: https://developer.github.com/v3/#rate-limiting
|
||||
This action fetches the latest version of Hugo by [hugo | Homebrew Formulae](https://formulae.brew.sh/formula/hugo)
|
||||
|
||||
|
||||
|
||||
|
||||
18
__tests__/get-os.test.ts
Normal file
18
__tests__/get-os.test.ts
Normal file
@@ -0,0 +1,18 @@
|
||||
import getOS from '../src/get-os';
|
||||
|
||||
describe('getOS', () => {
|
||||
test('test', () => {
|
||||
expect(getOS('linux')).toBe('Linux');
|
||||
expect(getOS('darwin')).toBe('macOS');
|
||||
expect(getOS('win32')).toBe('Windows');
|
||||
});
|
||||
|
||||
test('test exception', () => {
|
||||
// expect(() => {
|
||||
// getOS("win32");
|
||||
// }).toThrowError("Windows is not supported");
|
||||
expect(() => {
|
||||
getOS('centos');
|
||||
}).toThrowError('centos is not supported');
|
||||
});
|
||||
});
|
||||
22
__tests__/get-url.test.ts
Normal file
22
__tests__/get-url.test.ts
Normal file
@@ -0,0 +1,22 @@
|
||||
import getURL from '../src/get-url';
|
||||
|
||||
describe('getURL()', () => {
|
||||
test('test', () => {
|
||||
const baseURL =
|
||||
'https://github.com/gohugoio/hugo/releases/download/v0.58.2';
|
||||
const urlLinux = `${baseURL}/hugo_0.58.2_Linux-64bit.tar.gz`;
|
||||
const urlLinuxExtended = `${baseURL}/hugo_extended_0.58.2_Linux-64bit.tar.gz`;
|
||||
const urlMacOS = `${baseURL}/hugo_0.58.2_macOS-64bit.tar.gz`;
|
||||
const urlWindows = `${baseURL}/hugo_0.58.2_Windows-64bit.zip`;
|
||||
expect(getURL('Linux', 'false', '0.58.2')).toBe(urlLinux);
|
||||
expect(getURL('Linux', 'true', '0.58.2')).toBe(urlLinuxExtended);
|
||||
expect(getURL('macOS', 'false', '0.58.2')).toBe(urlMacOS);
|
||||
expect(getURL('Windows', 'false', '0.58.2')).toBe(urlWindows);
|
||||
});
|
||||
|
||||
// test("test exception", () => {
|
||||
// expect(() => {
|
||||
// getURL("Linux", "hoge", "0.58.2");
|
||||
// }).toThrowError("Invalid input (extended): hoge");
|
||||
// });
|
||||
});
|
||||
@@ -1,5 +1,5 @@
|
||||
name: 'Hugo build action'
|
||||
description: 'GitHub Actions for Hugo extended and Hugo Modules'
|
||||
name: 'Hugo setup action'
|
||||
description: 'GitHub Actions for Hugo ⚡️ Setup Hugo quickly and build your site fast, Hugo extended and Hugo Modules are supported.'
|
||||
author: 'peaceiris'
|
||||
inputs:
|
||||
hugo-version:
|
||||
@@ -12,4 +12,7 @@ inputs:
|
||||
default: 'false'
|
||||
runs:
|
||||
using: 'node12'
|
||||
main: 'index.js'
|
||||
main: 'lib/index.js'
|
||||
branding:
|
||||
icon: 'package'
|
||||
color: 'yellow'
|
||||
|
||||
@@ -1,25 +0,0 @@
|
||||
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
|
||||
|
||||
function getLatestVersion() {
|
||||
// return new Promise((resolve, reject) => {
|
||||
return new Promise(resolve => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
const url = "https://api.github.com/repos/gohugoio/hugo/releases/latest";
|
||||
xhr.open("GET", url);
|
||||
xhr.send();
|
||||
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
const result = JSON.parse(xhr.responseText);
|
||||
const latestURL = result["assets"][0].browser_download_url;
|
||||
const latestVersion = latestURL.match(/(\d+).(\d+).(\d+)/g)[0];
|
||||
|
||||
resolve(latestVersion);
|
||||
// } else {
|
||||
// reject(`ERROR: got status ${xhr.status}`);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
|
||||
module.exports = getLatestVersion;
|
||||
54
index.js
54
index.js
@@ -1,54 +0,0 @@
|
||||
const core = require("@actions/core");
|
||||
const tc = require("@actions/tool-cache");
|
||||
const io = require("@actions/io");
|
||||
const getLatestVersion = require("./get-latest-version");
|
||||
|
||||
// most @actions toolkit packages have async methods
|
||||
async function run() {
|
||||
try {
|
||||
getLatestVersion().then(async function(latestVersion) {
|
||||
let hugoVersion = core.getInput("hugo-version");
|
||||
if (!hugoVersion || hugoVersion === "latest") {
|
||||
hugoVersion = latestVersion;
|
||||
}
|
||||
core.debug(`Hugo version: ${hugoVersion}`);
|
||||
|
||||
let extended = core.getInput("extended");
|
||||
core.debug(`Hugo extended: ${extended}`);
|
||||
|
||||
let extendedStr = "";
|
||||
if (extended === "true") {
|
||||
extendedStr = "extended_";
|
||||
}
|
||||
|
||||
console.log(`Operating System: ${process.platform}`);
|
||||
|
||||
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 hugoPath = "/home/runner/bin";
|
||||
await io.mkdirP(hugoPath);
|
||||
core.addPath(hugoPath);
|
||||
|
||||
// Download and extract Hugo binary
|
||||
const hugoTarball = await tc.downloadTool(hugoURL);
|
||||
const hugoExtractedFolder = await tc.extractTar(hugoTarball, "/tmp");
|
||||
core.debug("hugoExtractedFolder:", hugoExtractedFolder);
|
||||
await io.mv(`${hugoExtractedFolder}/hugo`, hugoPath);
|
||||
// },
|
||||
// function(error) {
|
||||
// console.error(error);
|
||||
// console.log(
|
||||
// "HINT: GitHub API Rate limiting",
|
||||
// "https://developer.github.com/v3/#rate-limiting"
|
||||
// );
|
||||
});
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
@@ -1,23 +0,0 @@
|
||||
const wait = require('./wait');
|
||||
const process = require('process');
|
||||
const cp = require('child_process');
|
||||
const path = require('path');
|
||||
|
||||
test('throws invalid number', async() => {
|
||||
await expect(wait('foo')).rejects.toThrow('milleseconds not a number');
|
||||
});
|
||||
|
||||
test('wait 500 ms', async() => {
|
||||
const start = new Date();
|
||||
await wait(500);
|
||||
const end = new Date();
|
||||
var delta = Math.abs(end - start);
|
||||
expect(delta).toBeGreaterThan(450);
|
||||
});
|
||||
|
||||
// shows how the runner will run a javascript action with env / stdout protocol
|
||||
test('test runs', () => {
|
||||
process.env['INPUT_MILLISECONDS'] = 500;
|
||||
const ip = path.join(__dirname, 'index.js');
|
||||
console.log(cp.execSync(`node ${ip}`).toString());
|
||||
})
|
||||
11
jest.config.js
Normal file
11
jest.config.js
Normal file
@@ -0,0 +1,11 @@
|
||||
module.exports = {
|
||||
clearMocks: true,
|
||||
moduleFileExtensions: ['js', 'ts'],
|
||||
testEnvironment: 'node',
|
||||
testMatch: ['**/*.test.ts'],
|
||||
testRunner: 'jest-circus/runner',
|
||||
transform: {
|
||||
'^.+\\.ts$': 'ts-jest'
|
||||
},
|
||||
verbose: true
|
||||
}
|
||||
23
lib/get-latest-version.js
Normal file
23
lib/get-latest-version.js
Normal file
@@ -0,0 +1,23 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
|
||||
function getLatestVersion() {
|
||||
return new Promise((resolve, reject) => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
const url = 'https://formulae.brew.sh/api/formula/hugo.json';
|
||||
xhr.open('GET', url);
|
||||
xhr.send();
|
||||
xhr.onreadystatechange = function () {
|
||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
const result = JSON.parse(xhr.responseText);
|
||||
const latestVersion = result.versions.stable;
|
||||
resolve(latestVersion);
|
||||
}
|
||||
else if (xhr.readyState === 4 && xhr.status !== 200) {
|
||||
reject(`ERROR: got status ${xhr.status} of ${url}`);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
exports.default = getLatestVersion;
|
||||
//# sourceMappingURL=get-latest-version.js.map
|
||||
1
lib/get-latest-version.js.map
Normal file
1
lib/get-latest-version.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"get-latest-version.js","sourceRoot":"","sources":["../src/get-latest-version.ts"],"names":[],"mappings":";;AAAA,MAAM,cAAc,GAAG,OAAO,CAAC,gBAAgB,CAAC,CAAC,cAAc,CAAC;AAEhE,SAAwB,gBAAgB;IACtC,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrC,MAAM,GAAG,GAAG,IAAI,cAAc,EAAE,CAAC;QACjC,MAAM,GAAG,GAAW,gDAAgD,CAAC;QACrE,GAAG,CAAC,IAAI,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;QACrB,GAAG,CAAC,IAAI,EAAE,CAAC;QACX,GAAG,CAAC,kBAAkB,GAAG;YACvB,IAAI,GAAG,CAAC,UAAU,KAAK,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;gBAC9C,MAAM,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC;gBAC5C,MAAM,aAAa,GAAW,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC;gBACrD,OAAO,CAAC,aAAa,CAAC,CAAC;aACxB;iBAAM,IAAI,GAAG,CAAC,UAAU,KAAK,CAAC,IAAI,GAAG,CAAC,MAAM,KAAK,GAAG,EAAE;gBACrD,MAAM,CAAC,qBAAqB,GAAG,CAAC,MAAM,OAAO,GAAG,EAAE,CAAC,CAAC;aACrD;QACH,CAAC,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAhBD,mCAgBC"}
|
||||
18
lib/get-os.js
Normal file
18
lib/get-os.js
Normal file
@@ -0,0 +1,18 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function getOS(platform) {
|
||||
if (platform === 'linux') {
|
||||
return 'Linux';
|
||||
}
|
||||
else if (platform === 'darwin') {
|
||||
return 'macOS';
|
||||
}
|
||||
else if (platform === 'win32') {
|
||||
return 'Windows';
|
||||
}
|
||||
else {
|
||||
throw new Error(`${platform} is not supported`);
|
||||
}
|
||||
}
|
||||
exports.default = getOS;
|
||||
//# sourceMappingURL=get-os.js.map
|
||||
1
lib/get-os.js.map
Normal file
1
lib/get-os.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"get-os.js","sourceRoot":"","sources":["../src/get-os.ts"],"names":[],"mappings":";;AAAA,SAAwB,KAAK,CAAC,QAAgB;IAC5C,IAAI,QAAQ,KAAK,OAAO,EAAE;QACxB,OAAO,OAAO,CAAC;KAChB;SAAM,IAAI,QAAQ,KAAK,QAAQ,EAAE;QAChC,OAAO,OAAO,CAAC;KAChB;SAAM,IAAI,QAAQ,KAAK,OAAO,EAAE;QAC/B,OAAO,SAAS,CAAC;KAElB;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,GAAG,QAAQ,mBAAmB,CAAC,CAAC;KACjD;AACH,CAAC;AAXD,wBAWC"}
|
||||
26
lib/get-url.js
Normal file
26
lib/get-url.js
Normal file
@@ -0,0 +1,26 @@
|
||||
"use strict";
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
function getURL(os, extended, version) {
|
||||
const extendedStr = (extended) => {
|
||||
if (extended === 'true') {
|
||||
return 'extended_';
|
||||
}
|
||||
else {
|
||||
return '';
|
||||
}
|
||||
};
|
||||
const ext = (os) => {
|
||||
if (os === 'Windows') {
|
||||
return 'zip';
|
||||
}
|
||||
else {
|
||||
return 'tar.gz';
|
||||
}
|
||||
};
|
||||
const hugoName = `hugo_${extendedStr(extended)}${version}_${os}-64bit`;
|
||||
const baseURL = 'https://github.com/gohugoio/hugo/releases/download';
|
||||
const url = `${baseURL}/v${version}/${hugoName}.${ext(os)}`;
|
||||
return url;
|
||||
}
|
||||
exports.default = getURL;
|
||||
//# sourceMappingURL=get-url.js.map
|
||||
1
lib/get-url.js.map
Normal file
1
lib/get-url.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"get-url.js","sourceRoot":"","sources":["../src/get-url.ts"],"names":[],"mappings":";;AAAA,SAAwB,MAAM,CAC5B,EAAU,EACV,QAAgB,EAChB,OAAe;IAEf,MAAM,WAAW,GAAG,CAAC,QAAgB,EAAE,EAAE;QACvC,IAAI,QAAQ,KAAK,MAAM,EAAE;YACvB,OAAO,WAAW,CAAC;SACpB;aAAM;YACL,OAAO,EAAE,CAAC;SAGX;IACH,CAAC,CAAC;IAEF,MAAM,GAAG,GAAG,CAAC,EAAU,EAAE,EAAE;QACzB,IAAI,EAAE,KAAK,SAAS,EAAE;YACpB,OAAO,KAAK,CAAC;SACd;aAAM;YACL,OAAO,QAAQ,CAAC;SACjB;IACH,CAAC,CAAC;IAEF,MAAM,QAAQ,GAAW,QAAQ,WAAW,CAC1C,QAAQ,CACT,GAAG,OAAO,IAAI,EAAE,QAAQ,CAAC;IAC1B,MAAM,OAAO,GAAW,oDAAoD,CAAC;IAC7E,MAAM,GAAG,GAAW,GAAG,OAAO,KAAK,OAAO,IAAI,QAAQ,IAAI,GAAG,CAAC,EAAE,CAAC,EAAE,CAAC;IAEpE,OAAO,GAAG,CAAC;AACb,CAAC;AA9BD,yBA8BC"}
|
||||
56
lib/index.js
Normal file
56
lib/index.js
Normal file
@@ -0,0 +1,56 @@
|
||||
"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;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const exec = __importStar(require("@actions/exec"));
|
||||
const get_latest_version_1 = __importDefault(require("./get-latest-version"));
|
||||
const installer_1 = __importDefault(require("./installer"));
|
||||
function run() {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const dump = () => __awaiter(this, void 0, void 0, function* () {
|
||||
yield exec.exec('hugo version');
|
||||
});
|
||||
try {
|
||||
const hugoVersion = core.getInput('hugo-version');
|
||||
if (hugoVersion === '' || hugoVersion === 'latest') {
|
||||
get_latest_version_1.default().then(function (latestVersion) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
console.log(`Hugo version: ${latestVersion} (${hugoVersion})`);
|
||||
yield installer_1.default(latestVersion);
|
||||
yield dump();
|
||||
});
|
||||
}, function (error) {
|
||||
core.setFailed(error);
|
||||
});
|
||||
}
|
||||
else {
|
||||
console.log(`Hugo version: ${hugoVersion}`);
|
||||
yield installer_1.default(hugoVersion);
|
||||
yield dump();
|
||||
}
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
run();
|
||||
//# sourceMappingURL=index.js.map
|
||||
1
lib/index.js.map
Normal file
1
lib/index.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AACtC,oDAAsC;AACtC,8EAAoD;AACpD,4DAAoC;AAGpC,SAAe,GAAG;;QAChB,MAAM,IAAI,GAAG,GAAS,EAAE;YAEtB,MAAM,IAAI,CAAC,IAAI,CAAC,cAAc,CAAC,CAAC;QAClC,CAAC,CAAA,CAAC;QAEF,IAAI;YACF,MAAM,WAAW,GAAW,IAAI,CAAC,QAAQ,CAAC,cAAc,CAAC,CAAC;YAE1D,IAAI,WAAW,KAAK,EAAE,IAAI,WAAW,KAAK,QAAQ,EAAE;gBAClD,4BAAgB,EAAE,CAAC,IAAI,CACrB,UAAe,aAAa;;wBAC1B,OAAO,CAAC,GAAG,CAAC,iBAAiB,aAAa,KAAK,WAAW,GAAG,CAAC,CAAC;wBAC/D,MAAM,mBAAS,CAAC,aAAa,CAAC,CAAC;wBAC/B,MAAM,IAAI,EAAE,CAAC;oBACf,CAAC;iBAAA,EACD,UAAS,KAAK;oBACZ,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,CAAC;gBACxB,CAAC,CACF,CAAC;aACH;iBAAM;gBACL,OAAO,CAAC,GAAG,CAAC,iBAAiB,WAAW,EAAE,CAAC,CAAC;gBAC5C,MAAM,mBAAS,CAAC,WAAW,CAAC,CAAC;gBAC7B,MAAM,IAAI,EAAE,CAAC;aACd;SACF;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SAC/B;IACH,CAAC;CAAA;AAED,GAAG,EAAE,CAAC"}
|
||||
57
lib/installer.js
Normal file
57
lib/installer.js
Normal file
@@ -0,0 +1,57 @@
|
||||
"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;
|
||||
};
|
||||
var __importDefault = (this && this.__importDefault) || function (mod) {
|
||||
return (mod && mod.__esModule) ? mod : { "default": mod };
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const core = __importStar(require("@actions/core"));
|
||||
const tc = __importStar(require("@actions/tool-cache"));
|
||||
const io = __importStar(require("@actions/io"));
|
||||
const get_os_1 = __importDefault(require("./get-os"));
|
||||
const get_url_1 = __importDefault(require("./get-url"));
|
||||
function installer(version) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
try {
|
||||
const extended = core.getInput('extended');
|
||||
console.log(`Hugo extended: ${extended}`);
|
||||
const osName = get_os_1.default(process.platform);
|
||||
console.log(`Operating System: ${osName}`);
|
||||
const hugoURL = get_url_1.default(osName, extended, version);
|
||||
core.debug(`hugoURL: ${hugoURL}`);
|
||||
const hugoPath = `${process.env.HOME}/bin`;
|
||||
yield io.mkdirP(hugoPath);
|
||||
core.addPath(hugoPath);
|
||||
const hugoAssets = yield tc.downloadTool(hugoURL);
|
||||
let hugoBin = '';
|
||||
if (osName === 'Windows') {
|
||||
const hugoExtractedFolder = yield tc.extractZip(hugoAssets, '/tmp');
|
||||
hugoBin = `${hugoExtractedFolder}/hugo.exe`;
|
||||
}
|
||||
else {
|
||||
const hugoExtractedFolder = yield tc.extractTar(hugoAssets, '/tmp');
|
||||
hugoBin = `${hugoExtractedFolder}/hugo`;
|
||||
}
|
||||
yield io.mv(hugoBin, hugoPath);
|
||||
}
|
||||
catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
});
|
||||
}
|
||||
exports.default = installer;
|
||||
//# sourceMappingURL=installer.js.map
|
||||
1
lib/installer.js.map
Normal file
1
lib/installer.js.map
Normal file
@@ -0,0 +1 @@
|
||||
{"version":3,"file":"installer.js","sourceRoot":"","sources":["../src/installer.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;AAAA,oDAAsC;AACtC,wDAA0C;AAC1C,gDAAkC;AAClC,sDAA6B;AAC7B,wDAA+B;AAE/B,SAA8B,SAAS,CAAC,OAAe;;QACrD,IAAI;YACF,MAAM,QAAQ,GAAW,IAAI,CAAC,QAAQ,CAAC,UAAU,CAAC,CAAC;YACnD,OAAO,CAAC,GAAG,CAAC,kBAAkB,QAAQ,EAAE,CAAC,CAAC;YAE1C,MAAM,MAAM,GAAW,gBAAK,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAC/C,OAAO,CAAC,GAAG,CAAC,qBAAqB,MAAM,EAAE,CAAC,CAAC;YAE3C,MAAM,OAAO,GAAW,iBAAM,CAAC,MAAM,EAAE,QAAQ,EAAE,OAAO,CAAC,CAAC;YAC1D,IAAI,CAAC,KAAK,CAAC,YAAY,OAAO,EAAE,CAAC,CAAC;YAElC,MAAM,QAAQ,GAAW,GAAG,OAAO,CAAC,GAAG,CAAC,IAAI,MAAM,CAAC;YACnD,MAAM,EAAE,CAAC,MAAM,CAAC,QAAQ,CAAC,CAAC;YAC1B,IAAI,CAAC,OAAO,CAAC,QAAQ,CAAC,CAAC;YAGvB,MAAM,UAAU,GAAW,MAAM,EAAE,CAAC,YAAY,CAAC,OAAO,CAAC,CAAC;YAC1D,IAAI,OAAO,GAAW,EAAE,CAAC;YACzB,IAAI,MAAM,KAAK,SAAS,EAAE;gBACxB,MAAM,mBAAmB,GAAW,MAAM,EAAE,CAAC,UAAU,CACrD,UAAU,EACV,MAAM,CACP,CAAC;gBACF,OAAO,GAAG,GAAG,mBAAmB,WAAW,CAAC;aAC7C;iBAAM;gBACL,MAAM,mBAAmB,GAAW,MAAM,EAAE,CAAC,UAAU,CACrD,UAAU,EACV,MAAM,CACP,CAAC;gBACF,OAAO,GAAG,GAAG,mBAAmB,OAAO,CAAC;aACzC;YACD,MAAM,EAAE,CAAC,EAAE,CAAC,OAAO,EAAE,QAAQ,CAAC,CAAC;SAChC;QAAC,OAAO,KAAK,EAAE;YACd,IAAI,CAAC,SAAS,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;SAC/B;IACH,CAAC;CAAA;AAnCD,4BAmCC"}
|
||||
7
node_modules/@actions/core/LICENSE.md
generated
vendored
7
node_modules/@actions/core/LICENSE.md
generated
vendored
@@ -1,7 +0,0 @@
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
40
node_modules/@actions/core/README.md
generated
vendored
40
node_modules/@actions/core/README.md
generated
vendored
@@ -4,45 +4,53 @@
|
||||
|
||||
## Usage
|
||||
|
||||
#### Inputs/Outputs
|
||||
|
||||
You can use this library to get inputs or set outputs:
|
||||
### Import the package
|
||||
|
||||
```js
|
||||
// javascript
|
||||
const core = require('@actions/core');
|
||||
|
||||
const myInput = core.getInput('inputName', { required: true });
|
||||
// typescript
|
||||
import * as core from '@actions/core';
|
||||
```
|
||||
|
||||
// Do stuff
|
||||
#### Inputs/Outputs
|
||||
|
||||
Action inputs can be read with `getInput`. Outputs can be set with `setOutput` which makes them available to be mapped into inputs of other actions to ensure they are decoupled.
|
||||
|
||||
```js
|
||||
const myInput = core.getInput('inputName', { required: true });
|
||||
|
||||
core.setOutput('outputKey', 'outputVal');
|
||||
```
|
||||
|
||||
#### Exporting variables
|
||||
|
||||
You can also export variables for future steps. Variables get set in the environment.
|
||||
Since each step runs in a separate process, you can use `exportVariable` to add it to this step and future steps environment blocks.
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
// Do stuff
|
||||
|
||||
core.exportVariable('envVar', 'Val');
|
||||
```
|
||||
|
||||
#### Setting a secret
|
||||
|
||||
Setting a secret registers the secret with the runner to ensure it is masked in logs.
|
||||
|
||||
```js
|
||||
core.setSecret('myPassword');
|
||||
```
|
||||
|
||||
#### PATH Manipulation
|
||||
|
||||
You can explicitly add items to the path for all remaining steps in a workflow:
|
||||
To make a tool's path available in the path for the remainder of the job (without altering the machine or containers state), use `addPath`. The runner will prepend the path given to the jobs PATH.
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
|
||||
core.addPath('pathToTool');
|
||||
core.addPath('/path/to/mytool');
|
||||
```
|
||||
|
||||
#### Exit codes
|
||||
|
||||
You should use this library to set the failing exit code for your action:
|
||||
You should use this library to set the failing exit code for your action. If status is not set and the script runs to completion, that will lead to a success.
|
||||
|
||||
```js
|
||||
const core = require('@actions/core');
|
||||
@@ -55,6 +63,8 @@ catch (err) {
|
||||
core.setFailed(`Action failed with error ${err}`);
|
||||
}
|
||||
|
||||
Note that `setNeutral` is not yet implemented in actions V2 but equivalent functionality is being planned.
|
||||
|
||||
```
|
||||
|
||||
#### Logging
|
||||
|
||||
8
node_modules/@actions/core/lib/command.js
generated
vendored
8
node_modules/@actions/core/lib/command.js
generated
vendored
@@ -20,7 +20,7 @@ function issue(name, message = '') {
|
||||
issueCommand(name, {}, message);
|
||||
}
|
||||
exports.issue = issue;
|
||||
const CMD_PREFIX = '##[';
|
||||
const CMD_STRING = '::';
|
||||
class Command {
|
||||
constructor(command, properties, message) {
|
||||
if (!command) {
|
||||
@@ -31,7 +31,7 @@ class Command {
|
||||
this.message = message;
|
||||
}
|
||||
toString() {
|
||||
let cmdStr = CMD_PREFIX + this.command;
|
||||
let cmdStr = CMD_STRING + this.command;
|
||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||
cmdStr += ' ';
|
||||
for (const key in this.properties) {
|
||||
@@ -40,12 +40,12 @@ class Command {
|
||||
if (val) {
|
||||
// safely append the val - avoid blowing up when attempting to
|
||||
// call .replace() if message is not a string for some reason
|
||||
cmdStr += `${key}=${escape(`${val || ''}`)};`;
|
||||
cmdStr += `${key}=${escape(`${val || ''}`)},`;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
cmdStr += ']';
|
||||
cmdStr += CMD_STRING;
|
||||
// safely append the message - avoid blowing up when attempting to
|
||||
// call .replace() if message is not a string for some reason
|
||||
const message = `${this.message || ''}`;
|
||||
|
||||
2
node_modules/@actions/core/lib/command.js.map
generated
vendored
2
node_modules/@actions/core/lib/command.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"command.js","sourceRoot":"","sources":["../src/command.ts"],"names":[],"mappings":";;AAAA,yBAAwB;AAQxB;;;;;;;;;GASG;AACH,SAAgB,YAAY,CAC1B,OAAe,EACf,UAA6B,EAC7B,OAAe;IAEf,MAAM,GAAG,GAAG,IAAI,OAAO,CAAC,OAAO,EAAE,UAAU,EAAE,OAAO,CAAC,CAAA;IACrD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,GAAG,CAAC,QAAQ,EAAE,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AAC/C,CAAC;AAPD,oCAOC;AAED,SAAgB,KAAK,CAAC,IAAY,EAAE,UAAkB,EAAE;IACtD,YAAY,CAAC,IAAI,EAAE,EAAE,EAAE,OAAO,CAAC,CAAA;AACjC,CAAC;AAFD,sBAEC;AAED,MAAM,UAAU,GAAG,KAAK,CAAA;AAExB,MAAM,OAAO;IAKX,YAAY,OAAe,EAAE,UAA6B,EAAE,OAAe;QACzE,IAAI,CAAC,OAAO,EAAE;YACZ,OAAO,GAAG,iBAAiB,CAAA;SAC5B;QAED,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;QACtB,IAAI,CAAC,UAAU,GAAG,UAAU,CAAA;QAC5B,IAAI,CAAC,OAAO,GAAG,OAAO,CAAA;IACxB,CAAC;IAED,QAAQ;QACN,IAAI,MAAM,GAAG,UAAU,GAAG,IAAI,CAAC,OAAO,CAAA;QAEtC,IAAI,IAAI,CAAC,UAAU,IAAI,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,UAAU,CAAC,CAAC,MAAM,GAAG,CAAC,EAAE;YAC9D,MAAM,IAAI,GAAG,CAAA;YACb,KAAK,MAAM,GAAG,IAAI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E,CAAA;QACvC,MAAM,IAAI,UAAU,CAAC,OAAO,CAAC,CAAA;QAE7B,OAAO,MAAM,CAAA;IACf,CAAC;CACF;AAED,SAAS,UAAU,CAAC,CAAS;IAC3B,OAAO,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAC,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC,CAAA;AACtD,CAAC;AAED,SAAS,MAAM,CAAC,CAAS;IACvB,OAAO,CAAC;SACL,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,KAAK,EAAE,KAAK,CAAC;SACrB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC;SACpB,OAAO,CAAC,IAAI,EAAE,KAAK,CAAC,CAAA;AACzB,CAAC"}
|
||||
14
node_modules/@actions/core/lib/core.d.ts
generated
vendored
14
node_modules/@actions/core/lib/core.d.ts
generated
vendored
@@ -19,17 +19,16 @@ export declare enum ExitCode {
|
||||
Failure = 1
|
||||
}
|
||||
/**
|
||||
* sets env variable for this action and future actions in the job
|
||||
* Sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable
|
||||
*/
|
||||
export declare function exportVariable(name: string, val: string): void;
|
||||
/**
|
||||
* exports the variable and registers a secret which will get masked from logs
|
||||
* @param name the name of the variable to set
|
||||
* @param val value of the secret
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
*/
|
||||
export declare function exportSecret(name: string, val: string): void;
|
||||
export declare function setSecret(secret: string): void;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
@@ -71,6 +70,11 @@ export declare function error(message: string): void;
|
||||
* @param message warning issue message
|
||||
*/
|
||||
export declare function warning(message: string): void;
|
||||
/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
*/
|
||||
export declare function info(message: string): void;
|
||||
/**
|
||||
* Begin an output group.
|
||||
*
|
||||
|
||||
28
node_modules/@actions/core/lib/core.js
generated
vendored
28
node_modules/@actions/core/lib/core.js
generated
vendored
@@ -10,6 +10,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
|
||||
};
|
||||
Object.defineProperty(exports, "__esModule", { value: true });
|
||||
const command_1 = require("./command");
|
||||
const os = require("os");
|
||||
const path = require("path");
|
||||
/**
|
||||
* The code to exit an action
|
||||
@@ -29,7 +30,7 @@ var ExitCode;
|
||||
// Variables
|
||||
//-----------------------------------------------------------------------
|
||||
/**
|
||||
* sets env variable for this action and future actions in the job
|
||||
* Sets env variable for this action and future actions in the job
|
||||
* @param name the name of the variable to set
|
||||
* @param val the value of the variable
|
||||
*/
|
||||
@@ -39,18 +40,13 @@ function exportVariable(name, val) {
|
||||
}
|
||||
exports.exportVariable = exportVariable;
|
||||
/**
|
||||
* exports the variable and registers a secret which will get masked from logs
|
||||
* @param name the name of the variable to set
|
||||
* @param val value of the secret
|
||||
* Registers a secret which will get masked from logs
|
||||
* @param secret value of the secret
|
||||
*/
|
||||
function exportSecret(name, val) {
|
||||
exportVariable(name, val);
|
||||
// the runner will error with not implemented
|
||||
// leaving the function but raising the error earlier
|
||||
command_1.issueCommand('set-secret', {}, val);
|
||||
throw new Error('Not implemented.');
|
||||
function setSecret(secret) {
|
||||
command_1.issueCommand('add-mask', {}, secret);
|
||||
}
|
||||
exports.exportSecret = exportSecret;
|
||||
exports.setSecret = setSecret;
|
||||
/**
|
||||
* Prepends inputPath to the PATH (for this action and future actions)
|
||||
* @param inputPath
|
||||
@@ -68,7 +64,7 @@ exports.addPath = addPath;
|
||||
* @returns string
|
||||
*/
|
||||
function getInput(name, options) {
|
||||
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || '';
|
||||
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
||||
if (options && options.required && !val) {
|
||||
throw new Error(`Input required and not supplied: ${name}`);
|
||||
}
|
||||
@@ -125,6 +121,14 @@ function warning(message) {
|
||||
command_1.issue('warning', message);
|
||||
}
|
||||
exports.warning = warning;
|
||||
/**
|
||||
* Writes info to log with console.log.
|
||||
* @param message info message
|
||||
*/
|
||||
function info(message) {
|
||||
process.stdout.write(message + os.EOL);
|
||||
}
|
||||
exports.info = info;
|
||||
/**
|
||||
* Begin an output group.
|
||||
*
|
||||
|
||||
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
2
node_modules/@actions/core/lib/core.js.map
generated
vendored
@@ -1 +1 @@
|
||||
{"version":3,"file":"core.js","sourceRoot":"","sources":["../src/core.ts"],"names":[],"mappings":";;;;;;;;;;;AAAA,uCAA6C;AAE7C,6BAA4B;AAU5B;;GAEG;AACH,IAAY,QAUX;AAVD,WAAY,QAAQ;IAClB;;OAEG;IACH,6CAAW,CAAA;IAEX;;OAEG;IACH,6CAAW,CAAA;AACb,CAAC,EAVW,QAAQ,GAAR,gBAAQ,KAAR,gBAAQ,QAUnB;AAED,yEAAyE;AACzE,YAAY;AACZ,yEAAyE;AAEzE;;;;GAIG;AACH,SAAgB,cAAc,CAAC,IAAY,EAAE,GAAW;IACtD,OAAO,CAAC,GAAG,CAAC,IAAI,CAAC,GAAG,GAAG,CAAA;IACvB,sBAAY,CAAC,SAAS,EAAE,EAAC,IAAI,EAAC,EAAE,GAAG,CAAC,CAAA;AACtC,CAAC;AAHD,wCAGC;AAED;;;;GAIG;AACH,SAAgB,YAAY,CAAC,IAAY,EAAE,GAAW;IACpD,cAAc,CAAC,IAAI,EAAE,GAAG,CAAC,CAAA;IAEzB,6CAA6C;IAC7C,qDAAqD;IACrD,sBAAY,CAAC,YAAY,EAAE,EAAE,EAAE,GAAG,CAAC,CAAA;IACnC,MAAM,IAAI,KAAK,CAAC,kBAAkB,CAAC,CAAA;AACrC,CAAC;AAPD,oCAOC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,SAAiB;IACvC,sBAAY,CAAC,UAAU,EAAE,EAAE,EAAE,SAAS,CAAC,CAAA;IACvC,OAAO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AAA;AACpC,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,KAAK,CAAC,OAAe;IACnC,eAAK,CAAC,OAAO,EAAE,OAAO,CAAC,CAAA;AACzB,CAAC;AAFD,sBAEC;AAED;;;GAGG;AACH,SAAgB,OAAO,CAAC,OAAe;IACrC,eAAK,CAAC,SAAS,EAAE,OAAO,CAAC,CAAA;AAC3B,CAAC;AAFD,0BAEC;AAED;;;GAGG;AACH,SAAgB,IAAI,CAAC,OAAe;IAClC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,GAAG,EAAE,CAAC,GAAG,CAAC,CAAA;AACxC,CAAC;AAFD,oBAEC;AAED;;;;;;GAMG;AACH,SAAgB,UAAU,CAAC,IAAY;IACrC,eAAK,CAAC,OAAO,EAAE,IAAI,CAAC,CAAA;AACtB,CAAC;AAFD,gCAEC;AAED;;GAEG;AACH,SAAgB,QAAQ;IACtB,eAAK,CAAC,UAAU,CAAC,CAAA;AACnB,CAAC;AAFD,4BAEC;AAED;;;;;;;GAOG;AACH,SAAsB,KAAK,CAAI,IAAY,EAAE,EAAoB;;QAC/D,UAAU,CAAC,IAAI,CAAC,CAAA;QAEhB,IAAI,MAAS,CAAA;QAEb,IAAI;YACF,MAAM,GAAG,MAAM,EAAE,EAAE,CAAA;SACpB;gBAAS;YACR,QAAQ,EAAE,CAAA;SACX;QAED,OAAO,MAAM,CAAA;IACf,CAAC;CAAA;AAZD,sBAYC"}
|
||||
65
node_modules/@actions/core/package.json
generated
vendored
65
node_modules/@actions/core/package.json
generated
vendored
@@ -1,15 +1,38 @@
|
||||
{
|
||||
"_from": "@actions/core@^1.1.3",
|
||||
"_id": "@actions/core@1.1.3",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-2BIib53Jh4Cfm+1XNuZYYGTeRo8yiWEAUMoliMh1qQGMaqTF4VUlhhcsBylTu4qWmUx45DrY0y0XskimAHSqhw==",
|
||||
"_location": "/@actions/core",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@actions/core@^1.1.3",
|
||||
"name": "@actions/core",
|
||||
"version": "1.1.0",
|
||||
"description": "Actions core lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"core"
|
||||
"escapedName": "@actions%2fcore",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "^1.1.3",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.3"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/",
|
||||
"/@actions/tool-cache"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
||||
"license": "MIT",
|
||||
"main": "lib/core.js",
|
||||
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.3.tgz",
|
||||
"_shasum": "543b0e7ca0e53dccc5dca4811a4fac59c1b35f5c",
|
||||
"_spec": "@actions/core@^1.1.3",
|
||||
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Actions core lib",
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
@@ -17,26 +40,26 @@
|
||||
"files": [
|
||||
"lib"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"core"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/core.js",
|
||||
"name": "@actions/core",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/actions/toolkit.git"
|
||||
"url": "git+https://github.com/actions/toolkit.git",
|
||||
"directory": "packages/core"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/node": "^12.0.2"
|
||||
},
|
||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52"
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.0.tgz"
|
||||
,"_integrity": "sha512-KKpo3xzo0Zsikni9tbOsEQkxZBGDsYSJZNkTvmo0gPSXrc98TBOcdTvKwwjitjkjHkreTggWdB1ACiAFVgsuzA=="
|
||||
,"_from": "@actions/core@1.1.0"
|
||||
"version": "1.1.3"
|
||||
}
|
||||
7
node_modules/@actions/tool-cache/LICENSE.md
generated
vendored
7
node_modules/@actions/tool-cache/LICENSE.md
generated
vendored
@@ -1,7 +0,0 @@
|
||||
Copyright 2019 GitHub
|
||||
|
||||
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
||||
|
||||
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
||||
10
node_modules/@actions/tool-cache/README.md
generated
vendored
10
node_modules/@actions/tool-cache/README.md
generated
vendored
@@ -11,7 +11,7 @@ You can use this to download tools (or other files) from a download URL:
|
||||
```js
|
||||
const tc = require('@actions/tool-cache');
|
||||
|
||||
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||
```
|
||||
|
||||
#### Extract
|
||||
@@ -22,15 +22,15 @@ These can then be extracted in platform specific ways:
|
||||
const tc = require('@actions/tool-cache');
|
||||
|
||||
if (process.platform === 'win32') {
|
||||
const node12Path = tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip');
|
||||
const node12Path = tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.zip');
|
||||
const node12ExtractedFolder = await tc.extractZip(node12Path, 'path/to/extract/to');
|
||||
|
||||
// Or alternately
|
||||
const node12Path = tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
|
||||
const node12Path = tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-win-x64.7z');
|
||||
const node12ExtractedFolder = await tc.extract7z(node12Path, 'path/to/extract/to');
|
||||
}
|
||||
else {
|
||||
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
|
||||
}
|
||||
```
|
||||
@@ -45,7 +45,7 @@ You'll often want to add it to the path as part of this step:
|
||||
const tc = require('@actions/tool-cache');
|
||||
const core = require('@actions/core');
|
||||
|
||||
const node12Path = await tc.downloadTool('http://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||
const node12Path = await tc.downloadTool('https://nodejs.org/dist/v12.7.0/node-v12.7.0-linux-x64.tar.gz');
|
||||
const node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
|
||||
|
||||
const cachedPath = await tc.cacheDir(node12ExtractedFolder, 'node', '12.7.0');
|
||||
|
||||
13
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
13
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
@@ -217,14 +217,9 @@ function extractZip(file, dest) {
|
||||
if (IS_WINDOWS) {
|
||||
yield extractZipWin(file, dest);
|
||||
}
|
||||
else {
|
||||
if (process.platform === 'darwin') {
|
||||
yield extractZipDarwin(file, dest);
|
||||
}
|
||||
else {
|
||||
yield extractZipNix(file, dest);
|
||||
}
|
||||
}
|
||||
return dest;
|
||||
});
|
||||
}
|
||||
@@ -252,13 +247,7 @@ function extractZipWin(file, dest) {
|
||||
}
|
||||
function extractZipNix(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip');
|
||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||
});
|
||||
}
|
||||
function extractZipDarwin(file, dest) {
|
||||
return __awaiter(this, void 0, void 0, function* () {
|
||||
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip-darwin');
|
||||
const unzipPath = yield io.which('unzip');
|
||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
||||
});
|
||||
}
|
||||
|
||||
2
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
2
node_modules/@actions/tool-cache/lib/tool-cache.js.map
generated
vendored
File diff suppressed because one or more lines are too long
83
node_modules/@actions/tool-cache/package.json
generated
vendored
83
node_modules/@actions/tool-cache/package.json
generated
vendored
@@ -1,15 +1,48 @@
|
||||
{
|
||||
"_from": "@actions/tool-cache@^1.1.2",
|
||||
"_id": "@actions/tool-cache@1.1.2",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-IJczPaZr02ECa3Lgws/TJEVco9tjOujiQSZbO3dHuXXjhd5vrUtfOgGwhmz3/f97L910OraPZ8SknofUk6RvOQ==",
|
||||
"_location": "/@actions/tool-cache",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@actions/tool-cache@^1.1.2",
|
||||
"name": "@actions/tool-cache",
|
||||
"version": "1.1.1",
|
||||
"description": "Actions tool-cache lib",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"exec"
|
||||
"escapedName": "@actions%2ftool-cache",
|
||||
"scope": "@actions",
|
||||
"rawSpec": "^1.1.2",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^1.1.2"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||
"license": "MIT",
|
||||
"main": "lib/tool-cache.js",
|
||||
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.2.tgz",
|
||||
"_shasum": "304d44cecb9547324731e03ca004a3905e6530d2",
|
||||
"_spec": "@actions/tool-cache@^1.1.2",
|
||||
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo",
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.1.0",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/io": "^1.0.1",
|
||||
"semver": "^6.1.0",
|
||||
"typed-rest-client": "^1.4.0",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Actions tool-cache lib",
|
||||
"devDependencies": {
|
||||
"@types/nock": "^10.0.3",
|
||||
"@types/semver": "^6.0.0",
|
||||
"@types/uuid": "^3.4.4",
|
||||
"nock": "^10.0.6"
|
||||
},
|
||||
"directories": {
|
||||
"lib": "lib",
|
||||
"test": "__tests__"
|
||||
@@ -18,6 +51,15 @@
|
||||
"lib",
|
||||
"scripts"
|
||||
],
|
||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||
"keywords": [
|
||||
"github",
|
||||
"actions",
|
||||
"exec"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "lib/tool-cache.js",
|
||||
"name": "@actions/tool-cache",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
@@ -29,26 +71,5 @@
|
||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||
"tsc": "tsc"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/actions/toolkit/issues"
|
||||
},
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.1.0",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/io": "^1.0.1",
|
||||
"semver": "^6.1.0",
|
||||
"typed-rest-client": "^1.4.0",
|
||||
"uuid": "^3.3.2"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@types/nock": "^10.0.3",
|
||||
"@types/semver": "^6.0.0",
|
||||
"@types/uuid": "^3.4.4",
|
||||
"nock": "^10.0.6"
|
||||
},
|
||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52"
|
||||
|
||||
,"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.1.tgz"
|
||||
,"_integrity": "sha512-AILekrrj/L4N/5z5TGtUKVie4nKjxDioCgOEymyYxzPhGfjIxfE71tN2VTTpiICEWJ883rPRj2+WinTr1b6yVA=="
|
||||
,"_from": "@actions/tool-cache@1.1.1"
|
||||
"version": "1.1.2"
|
||||
}
|
||||
BIN
node_modules/@actions/tool-cache/scripts/externals/unzip
generated
vendored
BIN
node_modules/@actions/tool-cache/scripts/externals/unzip
generated
vendored
Binary file not shown.
BIN
node_modules/@actions/tool-cache/scripts/externals/unzip-darwin
generated
vendored
BIN
node_modules/@actions/tool-cache/scripts/externals/unzip-darwin
generated
vendored
Binary file not shown.
1190
package-lock.json
generated
1190
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
51
package.json
51
package.json
@@ -1,12 +1,31 @@
|
||||
{
|
||||
"name": "hugo-action",
|
||||
"version": "0.1.0",
|
||||
"version": "2.2.0",
|
||||
"description": "Hugo setup action",
|
||||
"main": "index.js",
|
||||
"main": "lib/index.js",
|
||||
"scripts": {
|
||||
"lint": "eslint ./index.js ./get-latest-version.js",
|
||||
"test": "jest",
|
||||
"build": "npm prune --production"
|
||||
"lint": "eslint ./src/**/*.ts",
|
||||
"lint:fix": "eslint --fix ./src/**/*.ts",
|
||||
"test": "jest --coverage --verbose",
|
||||
"build": "npm prune --production",
|
||||
"tsc": "tsc",
|
||||
"format": "prettier --write **/*.ts",
|
||||
"format:check": "prettier --check **/*.ts"
|
||||
},
|
||||
"husky": {
|
||||
"skipCI": true,
|
||||
"hooks": {
|
||||
"pre-commit": "lint-staged",
|
||||
"post-commit": "npm run tsc && npm run build && echo '⚠️ Do not forget to Commit and Push ./lib and ./node_modules'"
|
||||
}
|
||||
},
|
||||
"lint-staged": {
|
||||
"src/**/*.ts": [
|
||||
"prettier --check",
|
||||
"eslint",
|
||||
"jest --bail --findRelatedTests",
|
||||
"git add"
|
||||
]
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
@@ -16,7 +35,9 @@
|
||||
"GitHub",
|
||||
"Actions",
|
||||
"JavaScript",
|
||||
"Hugo"
|
||||
"TypeScript",
|
||||
"Hugo",
|
||||
"Setup"
|
||||
],
|
||||
"author": "peaceiris",
|
||||
"license": "MIT",
|
||||
@@ -25,13 +46,23 @@
|
||||
},
|
||||
"homepage": "https://github.com/peaceiris/actions-hugo#readme",
|
||||
"dependencies": {
|
||||
"@actions/core": "^1.1.0",
|
||||
"@actions/core": "^1.1.3",
|
||||
"@actions/exec": "^1.0.1",
|
||||
"@actions/io": "^1.0.1",
|
||||
"@actions/tool-cache": "^1.1.1",
|
||||
"@actions/tool-cache": "^1.1.2",
|
||||
"xmlhttprequest": "^1.8.0"
|
||||
},
|
||||
"devDependencies": {
|
||||
"eslint": "^6.3.0",
|
||||
"jest": "^24.9.0"
|
||||
"@types/jest": "^24.0.18",
|
||||
"@types/node": "^12.7.11",
|
||||
"@typescript-eslint/parser": "^2.3.2",
|
||||
"eslint": "^6.5.1",
|
||||
"husky": "^3.0.8",
|
||||
"jest": "^24.9.0",
|
||||
"jest-circus": "^24.9.0",
|
||||
"lint-staged": "^9.4.1",
|
||||
"prettier": "1.18.2",
|
||||
"ts-jest": "^24.1.0",
|
||||
"typescript": "^3.6.3"
|
||||
}
|
||||
}
|
||||
|
||||
19
src/get-latest-version.ts
Normal file
19
src/get-latest-version.ts
Normal file
@@ -0,0 +1,19 @@
|
||||
const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
|
||||
|
||||
export default function getLatestVersion(): Promise<string> {
|
||||
return new Promise((resolve, reject) => {
|
||||
const xhr = new XMLHttpRequest();
|
||||
const url: string = 'https://formulae.brew.sh/api/formula/hugo.json';
|
||||
xhr.open('GET', url);
|
||||
xhr.send();
|
||||
xhr.onreadystatechange = function() {
|
||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||
const result = JSON.parse(xhr.responseText);
|
||||
const latestVersion: string = result.versions.stable;
|
||||
resolve(latestVersion);
|
||||
} else if (xhr.readyState === 4 && xhr.status !== 200) {
|
||||
reject(`ERROR: got status ${xhr.status} of ${url}`);
|
||||
}
|
||||
};
|
||||
});
|
||||
}
|
||||
12
src/get-os.ts
Normal file
12
src/get-os.ts
Normal file
@@ -0,0 +1,12 @@
|
||||
export default function getOS(platform: string) {
|
||||
if (platform === 'linux') {
|
||||
return 'Linux';
|
||||
} else if (platform === 'darwin') {
|
||||
return 'macOS';
|
||||
} else if (platform === 'win32') {
|
||||
return 'Windows';
|
||||
// throw new Error("Windows is not supported");
|
||||
} else {
|
||||
throw new Error(`${platform} is not supported`);
|
||||
}
|
||||
}
|
||||
31
src/get-url.ts
Normal file
31
src/get-url.ts
Normal file
@@ -0,0 +1,31 @@
|
||||
export default function getURL(
|
||||
os: string,
|
||||
extended: string,
|
||||
version: string
|
||||
): string {
|
||||
const extendedStr = (extended: string) => {
|
||||
if (extended === 'true') {
|
||||
return 'extended_';
|
||||
} else {
|
||||
return '';
|
||||
// } else {
|
||||
// throw new Error(`Invalid input (extended): ${extended}`);
|
||||
}
|
||||
};
|
||||
|
||||
const ext = (os: string) => {
|
||||
if (os === 'Windows') {
|
||||
return 'zip';
|
||||
} else {
|
||||
return 'tar.gz';
|
||||
}
|
||||
};
|
||||
|
||||
const hugoName: string = `hugo_${extendedStr(
|
||||
extended
|
||||
)}${version}_${os}-64bit`;
|
||||
const baseURL: string = 'https://github.com/gohugoio/hugo/releases/download';
|
||||
const url: string = `${baseURL}/v${version}/${hugoName}.${ext(os)}`;
|
||||
|
||||
return url;
|
||||
}
|
||||
37
src/index.ts
Normal file
37
src/index.ts
Normal file
@@ -0,0 +1,37 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as exec from '@actions/exec';
|
||||
import getLatestVersion from './get-latest-version';
|
||||
import installer from './installer';
|
||||
|
||||
// most @actions toolkit packages have async methods
|
||||
async function run() {
|
||||
const dump = async () => {
|
||||
// Show version
|
||||
await exec.exec('hugo version');
|
||||
};
|
||||
|
||||
try {
|
||||
const hugoVersion: string = core.getInput('hugo-version');
|
||||
|
||||
if (hugoVersion === '' || hugoVersion === 'latest') {
|
||||
getLatestVersion().then(
|
||||
async function(latestVersion): Promise<void> {
|
||||
console.log(`Hugo version: ${latestVersion} (${hugoVersion})`);
|
||||
await installer(latestVersion);
|
||||
await dump();
|
||||
},
|
||||
function(error) {
|
||||
core.setFailed(error);
|
||||
}
|
||||
);
|
||||
} else {
|
||||
console.log(`Hugo version: ${hugoVersion}`);
|
||||
await installer(hugoVersion);
|
||||
await dump();
|
||||
}
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
|
||||
run();
|
||||
42
src/installer.ts
Normal file
42
src/installer.ts
Normal file
@@ -0,0 +1,42 @@
|
||||
import * as core from '@actions/core';
|
||||
import * as tc from '@actions/tool-cache';
|
||||
import * as io from '@actions/io';
|
||||
import getOS from './get-os';
|
||||
import getURL from './get-url';
|
||||
|
||||
export default async function installer(version: string) {
|
||||
try {
|
||||
const extended: string = core.getInput('extended');
|
||||
console.log(`Hugo extended: ${extended}`);
|
||||
|
||||
const osName: string = getOS(process.platform);
|
||||
console.log(`Operating System: ${osName}`);
|
||||
|
||||
const hugoURL: string = getURL(osName, extended, version);
|
||||
core.debug(`hugoURL: ${hugoURL}`);
|
||||
|
||||
const hugoPath: string = `${process.env.HOME}/bin`;
|
||||
await io.mkdirP(hugoPath);
|
||||
core.addPath(hugoPath);
|
||||
|
||||
// Download and extract Hugo binary
|
||||
const hugoAssets: string = await tc.downloadTool(hugoURL);
|
||||
let hugoBin: string = '';
|
||||
if (osName === 'Windows') {
|
||||
const hugoExtractedFolder: string = await tc.extractZip(
|
||||
hugoAssets,
|
||||
'/tmp'
|
||||
);
|
||||
hugoBin = `${hugoExtractedFolder}/hugo.exe`;
|
||||
} else {
|
||||
const hugoExtractedFolder: string = await tc.extractTar(
|
||||
hugoAssets,
|
||||
'/tmp'
|
||||
);
|
||||
hugoBin = `${hugoExtractedFolder}/hugo`;
|
||||
}
|
||||
await io.mv(hugoBin, hugoPath);
|
||||
} catch (error) {
|
||||
core.setFailed(error.message);
|
||||
}
|
||||
}
|
||||
63
tsconfig.json
Normal file
63
tsconfig.json
Normal file
@@ -0,0 +1,63 @@
|
||||
{
|
||||
"compilerOptions": {
|
||||
/* Basic Options */
|
||||
// "incremental": true, /* Enable incremental compilation */
|
||||
"target": "es6", /* Specify ECMAScript target version: 'ES3' (default), 'ES5', 'ES2015', 'ES2016', 'ES2017', 'ES2018', 'ES2019' or 'ESNEXT'. */
|
||||
"module": "commonjs", /* Specify module code generation: 'none', 'commonjs', 'amd', 'system', 'umd', 'es2015', or 'ESNext'. */
|
||||
// "allowJs": true, /* Allow javascript files to be compiled. */
|
||||
// "checkJs": true, /* Report errors in .js files. */
|
||||
// "jsx": "preserve", /* Specify JSX code generation: 'preserve', 'react-native', or 'react'. */
|
||||
// "declaration": true, /* Generates corresponding '.d.ts' file. */
|
||||
// "declarationMap": true, /* Generates a sourcemap for each corresponding '.d.ts' file. */
|
||||
"sourceMap": true, /* Generates corresponding '.map' file. */
|
||||
// "outFile": "./", /* Concatenate and emit output to single file. */
|
||||
"outDir": "./lib", /* Redirect output structure to the directory. */
|
||||
"rootDir": "./src", /* Specify the root directory of input files. Use to control the output directory structure with --outDir. */
|
||||
// "composite": true, /* Enable project compilation */
|
||||
// "tsBuildInfoFile": "./", /* Specify file to store incremental compilation information */
|
||||
"removeComments": true, /* Do not emit comments to output. */
|
||||
// "noEmit": true, /* Do not emit outputs. */
|
||||
// "importHelpers": true, /* Import emit helpers from 'tslib'. */
|
||||
// "downlevelIteration": true, /* Provide full support for iterables in 'for-of', spread, and destructuring when targeting 'ES5' or 'ES3'. */
|
||||
// "isolatedModules": true, /* Transpile each file as a separate module (similar to 'ts.transpileModule'). */
|
||||
|
||||
/* Strict Type-Checking Options */
|
||||
"strict": true, /* Enable all strict type-checking options. */
|
||||
"noImplicitAny": true, /* Raise error on expressions and declarations with an implied 'any' type. */
|
||||
// "strictNullChecks": true, /* Enable strict null checks. */
|
||||
// "strictFunctionTypes": true, /* Enable strict checking of function types. */
|
||||
// "strictBindCallApply": true, /* Enable strict 'bind', 'call', and 'apply' methods on functions. */
|
||||
// "strictPropertyInitialization": true, /* Enable strict checking of property initialization in classes. */
|
||||
// "noImplicitThis": true, /* Raise error on 'this' expressions with an implied 'any' type. */
|
||||
// "alwaysStrict": true, /* Parse in strict mode and emit "use strict" for each source file. */
|
||||
|
||||
/* Additional Checks */
|
||||
// "noUnusedLocals": true, /* Report errors on unused locals. */
|
||||
// "noUnusedParameters": true, /* Report errors on unused parameters. */
|
||||
// "noImplicitReturns": true, /* Report error when not all code paths in function return a value. */
|
||||
// "noFallthroughCasesInSwitch": true, /* Report errors for fallthrough cases in switch statement. */
|
||||
|
||||
/* Module Resolution Options */
|
||||
// "moduleResolution": "node", /* Specify module resolution strategy: 'node' (Node.js) or 'classic' (TypeScript pre-1.6). */
|
||||
// "baseUrl": "./", /* Base directory to resolve non-absolute module names. */
|
||||
// "paths": {}, /* A series of entries which re-map imports to lookup locations relative to the 'baseUrl'. */
|
||||
// "rootDirs": [], /* List of root folders whose combined content represents the structure of the project at runtime. */
|
||||
// "typeRoots": [], /* List of folders to include type definitions from. */
|
||||
// "types": [], /* Type declaration files to be included in compilation. */
|
||||
// "allowSyntheticDefaultImports": true, /* Allow default imports from modules with no default export. This does not affect code emit, just typechecking. */
|
||||
"esModuleInterop": true /* Enables emit interoperability between CommonJS and ES Modules via creation of namespace objects for all imports. Implies 'allowSyntheticDefaultImports'. */
|
||||
// "preserveSymlinks": true, /* Do not resolve the real path of symlinks. */
|
||||
// "allowUmdGlobalAccess": true, /* Allow accessing UMD globals from modules. */
|
||||
|
||||
/* Source Map Options */
|
||||
// "sourceRoot": "", /* Specify the location where debugger should locate TypeScript files instead of source locations. */
|
||||
// "mapRoot": "", /* Specify the location where debugger should locate map files instead of generated locations. */
|
||||
// "inlineSourceMap": true, /* Emit a single file with source maps instead of having a separate file. */
|
||||
// "inlineSources": true, /* Emit the source alongside the sourcemaps within a single file; requires '--inlineSourceMap' or '--sourceMap' to be set. */
|
||||
|
||||
/* Experimental Options */
|
||||
// "experimentalDecorators": true, /* Enables experimental support for ES7 decorators. */
|
||||
// "emitDecoratorMetadata": true, /* Enables experimental support for emitting type metadata for decorators. */
|
||||
},
|
||||
"exclude": ["node_modules", "**/*.test.ts"]
|
||||
}
|
||||
Reference in New Issue
Block a user