mirror of
https://github.com/peaceiris/actions-hugo.git
synced 2026-01-25 12:22:17 +01:00
Compare commits
21 Commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
8e97852759 | ||
|
|
b46070141b | ||
|
|
a1adb3bb7b | ||
|
|
fbb67a3359 | ||
|
|
2e5b1b84d6 | ||
|
|
6d819cab4c | ||
|
|
a6d33f08ac | ||
|
|
71663ea875 | ||
|
|
d7d48e3009 | ||
|
|
39aa1b7d04 | ||
|
|
b10091c0dc | ||
|
|
824187d952 | ||
|
|
e194c83989 | ||
|
|
c3970dfbdd | ||
|
|
082748017c | ||
|
|
79d6bc5f6e | ||
|
|
8f1aef7e73 | ||
|
|
dc8541739a | ||
|
|
4d54b90c0e | ||
|
|
25a3456032 | ||
|
|
4f371785be |
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
|
||||||
@@ -1,17 +1,19 @@
|
|||||||
{
|
{
|
||||||
"env": {
|
"env": {
|
||||||
"commonjs": true,
|
"commonjs": true,
|
||||||
"es6": true,
|
"es6": true,
|
||||||
"node": true
|
"node": true
|
||||||
},
|
},
|
||||||
"extends": "eslint:recommended",
|
"extends": "eslint:recommended",
|
||||||
"globals": {
|
"globals": {
|
||||||
"Atomics": "readonly",
|
"Atomics": "readonly",
|
||||||
"SharedArrayBuffer": "readonly"
|
"SharedArrayBuffer": "readonly"
|
||||||
},
|
},
|
||||||
"parserOptions": {
|
"parser": "@typescript-eslint/parser",
|
||||||
"ecmaVersion": 2018
|
"parserOptions": {
|
||||||
},
|
"sourceType": "module",
|
||||||
"rules": {
|
"ecmaVersion": 2019
|
||||||
}
|
},
|
||||||
}
|
"rules": {
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|||||||
36
.github/workflows/test.yml
vendored
36
.github/workflows/test.yml
vendored
@@ -1,6 +1,9 @@
|
|||||||
name: 'Test'
|
name: 'Test'
|
||||||
|
|
||||||
on: push
|
on:
|
||||||
|
pull_request:
|
||||||
|
types: [opened, synchronize]
|
||||||
|
push:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
@@ -8,32 +11,47 @@ jobs:
|
|||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: npm ci
|
run: npm ci
|
||||||
|
|
||||||
|
- name: Format check
|
||||||
|
run: npm run format:check
|
||||||
|
|
||||||
- name: Lint
|
- name: Lint
|
||||||
run: npm run lint
|
run: npm run lint
|
||||||
|
|
||||||
# - name: Test script
|
- name: Test
|
||||||
# run: npm test
|
run: npm test
|
||||||
|
|
||||||
# - name: Build production
|
- uses: actions/upload-artifact@master
|
||||||
# run: npm run build
|
with:
|
||||||
|
name: coverage
|
||||||
|
path: coverage
|
||||||
|
|
||||||
|
|
||||||
test-prod:
|
test-prod:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ${{ matrix.os }}
|
||||||
needs: test
|
needs: test
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
# hugo-version: ['latest']
|
os: ['ubuntu-18.04', 'macOS-10.14', 'windows-2019']
|
||||||
# extended: [true]
|
hugo-version: ['latest', '0.57.2']
|
||||||
hugo-version: ['latest', '0.58.2']
|
|
||||||
extended: [true, false]
|
extended: [true, false]
|
||||||
|
# exclude:
|
||||||
|
# - os: 'macOS-10.14'
|
||||||
|
# hugo-version: 'latest'
|
||||||
|
# extended: false
|
||||||
|
# - os: 'windows-2019'
|
||||||
|
# hugo-version: 'latest'
|
||||||
|
# extended: false
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
with:
|
||||||
|
fetch-depth: 1
|
||||||
|
|
||||||
- name: Test action
|
- name: Test action
|
||||||
uses: ./
|
uses: ./
|
||||||
|
|||||||
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
|
||||||
|
}
|
||||||
50
README.md
50
README.md
@@ -13,13 +13,35 @@
|
|||||||
|
|
||||||
We can run Hugo on a virtual machine of GitHub Actions by this Hugo action. Hugo extended version and Hugo Modules are supported.
|
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 action. We no longer build or pull a Hugo docker image. Thanks to this change, we can complete this action less than **2 sec**. (A docker base action was taking about 1 min or more execution time to build or pull.)
|
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
|
## Getting started
|
||||||
|
|
||||||
### Create your workflow
|
### ⭐️ Create your workflow
|
||||||
|
|
||||||
An example workflow `.github/workflows/gh-pages.yml` 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]
|
||||||
|
|
||||||
@@ -41,19 +63,23 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build-deploy:
|
build-deploy:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
# runs-on: macOS-10.14
|
||||||
|
# runs-on: windows-2019
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@master
|
- uses: actions/checkout@master
|
||||||
|
# with:
|
||||||
|
# submodules: true
|
||||||
|
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2.0.0
|
uses: peaceiris/actions-hugo@v2.2.0
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.58.2'
|
hugo-version: '0.58.3'
|
||||||
|
|
||||||
- name: Build
|
- name: Build
|
||||||
run: hugo --gc --minify --cleanDestinationDir
|
run: hugo --gc --minify --cleanDestinationDir
|
||||||
|
|
||||||
- name: Deploy
|
- name: Deploy
|
||||||
uses: peaceiris/actions-gh-pages@v2.3.1
|
uses: peaceiris/actions-gh-pages@v2.3.2
|
||||||
env:
|
env:
|
||||||
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
ACTIONS_DEPLOY_KEY: ${{ secrets.ACTIONS_DEPLOY_KEY }}
|
||||||
PUBLISH_BRANCH: gh-pages
|
PUBLISH_BRANCH: gh-pages
|
||||||
@@ -64,21 +90,25 @@ jobs:
|
|||||||
|
|
||||||
## Options
|
## Options
|
||||||
|
|
||||||
### Use Hugo extended
|
### ⭐️ Use Hugo extended
|
||||||
|
|
||||||
|
Set `extended: true` to use a Hugo extended version.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2.0.0
|
uses: peaceiris/actions-hugo@v2.2.0
|
||||||
with:
|
with:
|
||||||
hugo-version: '0.58.2'
|
hugo-version: '0.58.3'
|
||||||
extended: true
|
extended: true
|
||||||
```
|
```
|
||||||
|
|
||||||
### Use the latest version of Hugo
|
### ⭐️ Use the latest version of Hugo
|
||||||
|
|
||||||
|
Set `hugo-version: 'latest'` to use the latest version of Hugo.
|
||||||
|
|
||||||
```yaml
|
```yaml
|
||||||
- name: Setup Hugo
|
- name: Setup Hugo
|
||||||
uses: peaceiris/actions-hugo@v2.0.0
|
uses: peaceiris/actions-hugo@v2.2.0
|
||||||
with:
|
with:
|
||||||
hugo-version: 'latest'
|
hugo-version: 'latest'
|
||||||
```
|
```
|
||||||
|
|||||||
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");
|
||||||
|
// });
|
||||||
|
});
|
||||||
@@ -12,7 +12,7 @@ inputs:
|
|||||||
default: 'false'
|
default: 'false'
|
||||||
runs:
|
runs:
|
||||||
using: 'node12'
|
using: 'node12'
|
||||||
main: 'index.js'
|
main: 'lib/index.js'
|
||||||
branding:
|
branding:
|
||||||
icon: 'package'
|
icon: 'package'
|
||||||
color: 'yellow'
|
color: 'yellow'
|
||||||
|
|||||||
57
index.js
57
index.js
@@ -1,57 +0,0 @@
|
|||||||
const core = require("@actions/core");
|
|
||||||
const tc = require("@actions/tool-cache");
|
|
||||||
const io = require("@actions/io");
|
|
||||||
const exec = require("@actions/exec");
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
console.log(`Hugo version: ${hugoVersion}`);
|
|
||||||
|
|
||||||
const extended = core.getInput("extended");
|
|
||||||
console.log(`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 = `${process.env.HOME}/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);
|
|
||||||
|
|
||||||
// Show version
|
|
||||||
await exec.exec('hugo version');
|
|
||||||
await exec.exec('go version');
|
|
||||||
await exec.exec('git --version');
|
|
||||||
},
|
|
||||||
function(error) {
|
|
||||||
core.setFailed(error);
|
|
||||||
}
|
|
||||||
);
|
|
||||||
} 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.
|
|
||||||
192
node_modules/@actions/core/README.md
generated
vendored
192
node_modules/@actions/core/README.md
generated
vendored
@@ -1,97 +1,97 @@
|
|||||||
# `@actions/core`
|
# `@actions/core`
|
||||||
|
|
||||||
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
> Core functions for setting results, logging, registering secrets and exporting variables across actions
|
||||||
|
|
||||||
## Usage
|
## Usage
|
||||||
|
|
||||||
#### Inputs/Outputs
|
#### Inputs/Outputs
|
||||||
|
|
||||||
You can use this library to get inputs or set outputs:
|
You can use this library to get inputs or set outputs:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
const myInput = core.getInput('inputName', { required: true });
|
const myInput = core.getInput('inputName', { required: true });
|
||||||
|
|
||||||
// Do stuff
|
// Do stuff
|
||||||
|
|
||||||
core.setOutput('outputKey', 'outputVal');
|
core.setOutput('outputKey', 'outputVal');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Exporting variables
|
#### Exporting variables
|
||||||
|
|
||||||
You can also export variables for future steps. Variables get set in the environment.
|
You can also export variables for future steps. Variables get set in the environment.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
// Do stuff
|
// Do stuff
|
||||||
|
|
||||||
core.exportVariable('envVar', 'Val');
|
core.exportVariable('envVar', 'Val');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### PATH Manipulation
|
#### PATH Manipulation
|
||||||
|
|
||||||
You can explicitly add items to the path for all remaining steps in a workflow:
|
You can explicitly add items to the path for all remaining steps in a workflow:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
core.addPath('pathToTool');
|
core.addPath('pathToTool');
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Exit codes
|
#### 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:
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
try {
|
try {
|
||||||
// Do stuff
|
// Do stuff
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
// setFailed logs the message and sets a failing exit code
|
// setFailed logs the message and sets a failing exit code
|
||||||
core.setFailed(`Action failed with error ${err}`);
|
core.setFailed(`Action failed with error ${err}`);
|
||||||
}
|
}
|
||||||
|
|
||||||
```
|
```
|
||||||
|
|
||||||
#### Logging
|
#### Logging
|
||||||
|
|
||||||
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
Finally, this library provides some utilities for logging. Note that debug logging is hidden from the logs by default. This behavior can be toggled by enabling the [Step Debug Logs](../../docs/action-debugging.md#step-debug-logs).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const core = require('@actions/core');
|
const core = require('@actions/core');
|
||||||
|
|
||||||
const myInput = core.getInput('input');
|
const myInput = core.getInput('input');
|
||||||
try {
|
try {
|
||||||
core.debug('Inside try block');
|
core.debug('Inside try block');
|
||||||
|
|
||||||
if (!myInput) {
|
if (!myInput) {
|
||||||
core.warning('myInput was not set');
|
core.warning('myInput was not set');
|
||||||
}
|
}
|
||||||
|
|
||||||
// Do stuff
|
// Do stuff
|
||||||
}
|
}
|
||||||
catch (err) {
|
catch (err) {
|
||||||
core.error(`Error ${err}, action may still succeed though`);
|
core.error(`Error ${err}, action may still succeed though`);
|
||||||
}
|
}
|
||||||
```
|
```
|
||||||
|
|
||||||
This library can also wrap chunks of output in foldable groups.
|
This library can also wrap chunks of output in foldable groups.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
const core = require('@actions/core')
|
const core = require('@actions/core')
|
||||||
|
|
||||||
// Manually wrap output
|
// Manually wrap output
|
||||||
core.startGroup('Do some function')
|
core.startGroup('Do some function')
|
||||||
doSomeFunction()
|
doSomeFunction()
|
||||||
core.endGroup()
|
core.endGroup()
|
||||||
|
|
||||||
// Wrap an asynchronous function call
|
// Wrap an asynchronous function call
|
||||||
const result = await core.group('Do something async', async () => {
|
const result = await core.group('Do something async', async () => {
|
||||||
const response = await doSomeHTTPRequest()
|
const response = await doSomeHTTPRequest()
|
||||||
return response
|
return response
|
||||||
})
|
})
|
||||||
```
|
```
|
||||||
32
node_modules/@actions/core/lib/command.d.ts
generated
vendored
32
node_modules/@actions/core/lib/command.d.ts
generated
vendored
@@ -1,16 +1,16 @@
|
|||||||
interface CommandProperties {
|
interface CommandProperties {
|
||||||
[key: string]: string;
|
[key: string]: string;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
* Command Format:
|
* Command Format:
|
||||||
* ##[name key=value;key=value]message
|
* ##[name key=value;key=value]message
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* ##[warning]This is the user warning message
|
* ##[warning]This is the user warning message
|
||||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
||||||
*/
|
*/
|
||||||
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
|
export declare function issueCommand(command: string, properties: CommandProperties, message: string): void;
|
||||||
export declare function issue(name: string, message?: string): void;
|
export declare function issue(name: string, message?: string): void;
|
||||||
export {};
|
export {};
|
||||||
|
|||||||
130
node_modules/@actions/core/lib/command.js
generated
vendored
130
node_modules/@actions/core/lib/command.js
generated
vendored
@@ -1,66 +1,66 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const os = require("os");
|
const os = require("os");
|
||||||
/**
|
/**
|
||||||
* Commands
|
* Commands
|
||||||
*
|
*
|
||||||
* Command Format:
|
* Command Format:
|
||||||
* ##[name key=value;key=value]message
|
* ##[name key=value;key=value]message
|
||||||
*
|
*
|
||||||
* Examples:
|
* Examples:
|
||||||
* ##[warning]This is the user warning message
|
* ##[warning]This is the user warning message
|
||||||
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
* ##[set-secret name=mypassword]definitelyNotAPassword!
|
||||||
*/
|
*/
|
||||||
function issueCommand(command, properties, message) {
|
function issueCommand(command, properties, message) {
|
||||||
const cmd = new Command(command, properties, message);
|
const cmd = new Command(command, properties, message);
|
||||||
process.stdout.write(cmd.toString() + os.EOL);
|
process.stdout.write(cmd.toString() + os.EOL);
|
||||||
}
|
}
|
||||||
exports.issueCommand = issueCommand;
|
exports.issueCommand = issueCommand;
|
||||||
function issue(name, message = '') {
|
function issue(name, message = '') {
|
||||||
issueCommand(name, {}, message);
|
issueCommand(name, {}, message);
|
||||||
}
|
}
|
||||||
exports.issue = issue;
|
exports.issue = issue;
|
||||||
const CMD_PREFIX = '##[';
|
const CMD_STRING = '::';
|
||||||
class Command {
|
class Command {
|
||||||
constructor(command, properties, message) {
|
constructor(command, properties, message) {
|
||||||
if (!command) {
|
if (!command) {
|
||||||
command = 'missing.command';
|
command = 'missing.command';
|
||||||
}
|
}
|
||||||
this.command = command;
|
this.command = command;
|
||||||
this.properties = properties;
|
this.properties = properties;
|
||||||
this.message = message;
|
this.message = message;
|
||||||
}
|
}
|
||||||
toString() {
|
toString() {
|
||||||
let cmdStr = CMD_PREFIX + this.command;
|
let cmdStr = CMD_STRING + this.command;
|
||||||
if (this.properties && Object.keys(this.properties).length > 0) {
|
if (this.properties && Object.keys(this.properties).length > 0) {
|
||||||
cmdStr += ' ';
|
cmdStr += ' ';
|
||||||
for (const key in this.properties) {
|
for (const key in this.properties) {
|
||||||
if (this.properties.hasOwnProperty(key)) {
|
if (this.properties.hasOwnProperty(key)) {
|
||||||
const val = this.properties[key];
|
const val = this.properties[key];
|
||||||
if (val) {
|
if (val) {
|
||||||
// safely append the val - avoid blowing up when attempting to
|
// safely append the val - avoid blowing up when attempting to
|
||||||
// call .replace() if message is not a string for some reason
|
// 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
|
// safely append the message - avoid blowing up when attempting to
|
||||||
// call .replace() if message is not a string for some reason
|
// call .replace() if message is not a string for some reason
|
||||||
const message = `${this.message || ''}`;
|
const message = `${this.message || ''}`;
|
||||||
cmdStr += escapeData(message);
|
cmdStr += escapeData(message);
|
||||||
return cmdStr;
|
return cmdStr;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
function escapeData(s) {
|
function escapeData(s) {
|
||||||
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
return s.replace(/\r/g, '%0D').replace(/\n/g, '%0A');
|
||||||
}
|
}
|
||||||
function escape(s) {
|
function escape(s) {
|
||||||
return s
|
return s
|
||||||
.replace(/\r/g, '%0D')
|
.replace(/\r/g, '%0D')
|
||||||
.replace(/\n/g, '%0A')
|
.replace(/\n/g, '%0A')
|
||||||
.replace(/]/g, '%5D')
|
.replace(/]/g, '%5D')
|
||||||
.replace(/;/g, '%3B');
|
.replace(/;/g, '%3B');
|
||||||
}
|
}
|
||||||
//# sourceMappingURL=command.js.map
|
//# sourceMappingURL=command.js.map
|
||||||
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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|
||||||
* Interface for getInput options
|
* Interface for getInput options
|
||||||
*/
|
*/
|
||||||
export interface InputOptions {
|
export interface InputOptions {
|
||||||
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
/** Optional. Whether the input is required. If required and not present, will throw. Defaults to false */
|
||||||
required?: boolean;
|
required?: boolean;
|
||||||
}
|
}
|
||||||
/**
|
/**
|
||||||
* The code to exit an action
|
* The code to exit an action
|
||||||
*/
|
*/
|
||||||
export declare enum ExitCode {
|
export declare enum ExitCode {
|
||||||
/**
|
/**
|
||||||
* A code indicating that the action was successful
|
* A code indicating that the action was successful
|
||||||
*/
|
*/
|
||||||
Success = 0,
|
Success = 0,
|
||||||
/**
|
/**
|
||||||
* A code indicating that the action was a failure
|
* A code indicating that the action was a failure
|
||||||
*/
|
*/
|
||||||
Failure = 1
|
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 name the name of the variable to set
|
||||||
* @param val the value of the variable
|
* @param val the value of the variable
|
||||||
*/
|
*/
|
||||||
export declare function exportVariable(name: string, val: string): void;
|
export declare function exportVariable(name: string, val: string): void;
|
||||||
/**
|
/**
|
||||||
* exports the variable and registers a secret which will get masked from logs
|
* exports the variable and registers a secret which will get masked from logs
|
||||||
* @param name the name of the variable to set
|
* @param name the name of the variable to set
|
||||||
* @param val value of the secret
|
* @param val value of the secret
|
||||||
*/
|
*/
|
||||||
export declare function exportSecret(name: string, val: string): void;
|
export declare function exportSecret(name: string, val: string): void;
|
||||||
/**
|
/**
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
* Prepends inputPath to the PATH (for this action and future actions)
|
||||||
* @param inputPath
|
* @param inputPath
|
||||||
*/
|
*/
|
||||||
export declare function addPath(inputPath: string): void;
|
export declare function addPath(inputPath: string): void;
|
||||||
/**
|
/**
|
||||||
* Gets the value of an input. The value is also trimmed.
|
* Gets the value of an input. The value is also trimmed.
|
||||||
*
|
*
|
||||||
* @param name name of the input to get
|
* @param name name of the input to get
|
||||||
* @param options optional. See InputOptions.
|
* @param options optional. See InputOptions.
|
||||||
* @returns string
|
* @returns string
|
||||||
*/
|
*/
|
||||||
export declare function getInput(name: string, options?: InputOptions): string;
|
export declare function getInput(name: string, options?: InputOptions): string;
|
||||||
/**
|
/**
|
||||||
* Sets the value of an output.
|
* Sets the value of an output.
|
||||||
*
|
*
|
||||||
* @param name name of the output to set
|
* @param name name of the output to set
|
||||||
* @param value value to store
|
* @param value value to store
|
||||||
*/
|
*/
|
||||||
export declare function setOutput(name: string, value: string): void;
|
export declare function setOutput(name: string, value: string): void;
|
||||||
/**
|
/**
|
||||||
* Sets the action status to failed.
|
* Sets the action status to failed.
|
||||||
* When the action exits it will be with an exit code of 1
|
* When the action exits it will be with an exit code of 1
|
||||||
* @param message add error issue message
|
* @param message add error issue message
|
||||||
*/
|
*/
|
||||||
export declare function setFailed(message: string): void;
|
export declare function setFailed(message: string): void;
|
||||||
/**
|
/**
|
||||||
* Writes debug message to user log
|
* Writes debug message to user log
|
||||||
* @param message debug message
|
* @param message debug message
|
||||||
*/
|
*/
|
||||||
export declare function debug(message: string): void;
|
export declare function debug(message: string): void;
|
||||||
/**
|
/**
|
||||||
* Adds an error issue
|
* Adds an error issue
|
||||||
* @param message error issue message
|
* @param message error issue message
|
||||||
*/
|
*/
|
||||||
export declare function error(message: string): void;
|
export declare function error(message: string): void;
|
||||||
/**
|
/**
|
||||||
* Adds an warning issue
|
* Adds an warning issue
|
||||||
* @param message warning issue message
|
* @param message warning issue message
|
||||||
*/
|
*/
|
||||||
export declare function warning(message: string): void;
|
export declare function warning(message: string): void;
|
||||||
/**
|
/**
|
||||||
* Begin an output group.
|
* Writes info to log with console.log.
|
||||||
*
|
* @param message info message
|
||||||
* Output until the next `groupEnd` will be foldable in this group
|
*/
|
||||||
*
|
export declare function info(message: string): void;
|
||||||
* @param name The name of the output group
|
/**
|
||||||
*/
|
* Begin an output group.
|
||||||
export declare function startGroup(name: string): void;
|
*
|
||||||
/**
|
* Output until the next `groupEnd` will be foldable in this group
|
||||||
* End an output group.
|
*
|
||||||
*/
|
* @param name The name of the output group
|
||||||
export declare function endGroup(): void;
|
*/
|
||||||
/**
|
export declare function startGroup(name: string): void;
|
||||||
* Wrap an asynchronous function call in a group.
|
/**
|
||||||
*
|
* End an output group.
|
||||||
* Returns the same type as the function itself.
|
*/
|
||||||
*
|
export declare function endGroup(): void;
|
||||||
* @param name The name of the group
|
/**
|
||||||
* @param fn The function to wrap in the group
|
* Wrap an asynchronous function call in a group.
|
||||||
*/
|
*
|
||||||
export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
* Returns the same type as the function itself.
|
||||||
|
*
|
||||||
|
* @param name The name of the group
|
||||||
|
* @param fn The function to wrap in the group
|
||||||
|
*/
|
||||||
|
export declare function group<T>(name: string, fn: () => Promise<T>): Promise<T>;
|
||||||
|
|||||||
343
node_modules/@actions/core/lib/core.js
generated
vendored
343
node_modules/@actions/core/lib/core.js
generated
vendored
@@ -1,168 +1,177 @@
|
|||||||
"use strict";
|
"use strict";
|
||||||
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
|
||||||
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
|
||||||
return new (P || (P = Promise))(function (resolve, reject) {
|
return new (P || (P = Promise))(function (resolve, reject) {
|
||||||
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
|
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 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); }
|
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
|
||||||
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
step((generator = generator.apply(thisArg, _arguments || [])).next());
|
||||||
});
|
});
|
||||||
};
|
};
|
||||||
Object.defineProperty(exports, "__esModule", { value: true });
|
Object.defineProperty(exports, "__esModule", { value: true });
|
||||||
const command_1 = require("./command");
|
const command_1 = require("./command");
|
||||||
const path = require("path");
|
const os = require("os");
|
||||||
/**
|
const path = require("path");
|
||||||
* The code to exit an action
|
/**
|
||||||
*/
|
* The code to exit an action
|
||||||
var ExitCode;
|
*/
|
||||||
(function (ExitCode) {
|
var ExitCode;
|
||||||
/**
|
(function (ExitCode) {
|
||||||
* A code indicating that the action was successful
|
/**
|
||||||
*/
|
* A code indicating that the action was successful
|
||||||
ExitCode[ExitCode["Success"] = 0] = "Success";
|
*/
|
||||||
/**
|
ExitCode[ExitCode["Success"] = 0] = "Success";
|
||||||
* A code indicating that the action was a failure
|
/**
|
||||||
*/
|
* A code indicating that the action was a failure
|
||||||
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
*/
|
||||||
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
ExitCode[ExitCode["Failure"] = 1] = "Failure";
|
||||||
//-----------------------------------------------------------------------
|
})(ExitCode = exports.ExitCode || (exports.ExitCode = {}));
|
||||||
// Variables
|
//-----------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------
|
// Variables
|
||||||
/**
|
//-----------------------------------------------------------------------
|
||||||
* sets env variable for this action and future actions in the job
|
/**
|
||||||
* @param name the name of the variable to set
|
* sets env variable for this action and future actions in the job
|
||||||
* @param val the value of the variable
|
* @param name the name of the variable to set
|
||||||
*/
|
* @param val the value of the variable
|
||||||
function exportVariable(name, val) {
|
*/
|
||||||
process.env[name] = val;
|
function exportVariable(name, val) {
|
||||||
command_1.issueCommand('set-env', { name }, val);
|
process.env[name] = val;
|
||||||
}
|
command_1.issueCommand('set-env', { name }, val);
|
||||||
exports.exportVariable = exportVariable;
|
}
|
||||||
/**
|
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
|
* exports the variable and registers a secret which will get masked from logs
|
||||||
* @param val value of the secret
|
* @param name the name of the variable to set
|
||||||
*/
|
* @param val value of the secret
|
||||||
function exportSecret(name, val) {
|
*/
|
||||||
exportVariable(name, val);
|
function exportSecret(name, val) {
|
||||||
// the runner will error with not implemented
|
exportVariable(name, val);
|
||||||
// leaving the function but raising the error earlier
|
// the runner will error with not implemented
|
||||||
command_1.issueCommand('set-secret', {}, val);
|
// leaving the function but raising the error earlier
|
||||||
throw new Error('Not implemented.');
|
command_1.issueCommand('set-secret', {}, val);
|
||||||
}
|
throw new Error('Not implemented.');
|
||||||
exports.exportSecret = exportSecret;
|
}
|
||||||
/**
|
exports.exportSecret = exportSecret;
|
||||||
* Prepends inputPath to the PATH (for this action and future actions)
|
/**
|
||||||
* @param inputPath
|
* Prepends inputPath to the PATH (for this action and future actions)
|
||||||
*/
|
* @param inputPath
|
||||||
function addPath(inputPath) {
|
*/
|
||||||
command_1.issueCommand('add-path', {}, inputPath);
|
function addPath(inputPath) {
|
||||||
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
command_1.issueCommand('add-path', {}, inputPath);
|
||||||
}
|
process.env['PATH'] = `${inputPath}${path.delimiter}${process.env['PATH']}`;
|
||||||
exports.addPath = addPath;
|
}
|
||||||
/**
|
exports.addPath = addPath;
|
||||||
* Gets the value of an input. The value is also trimmed.
|
/**
|
||||||
*
|
* Gets the value of an input. The value is also trimmed.
|
||||||
* @param name name of the input to get
|
*
|
||||||
* @param options optional. See InputOptions.
|
* @param name name of the input to get
|
||||||
* @returns string
|
* @param options optional. See InputOptions.
|
||||||
*/
|
* @returns string
|
||||||
function getInput(name, options) {
|
*/
|
||||||
const val = process.env[`INPUT_${name.replace(' ', '_').toUpperCase()}`] || '';
|
function getInput(name, options) {
|
||||||
if (options && options.required && !val) {
|
const val = process.env[`INPUT_${name.replace(/ /g, '_').toUpperCase()}`] || '';
|
||||||
throw new Error(`Input required and not supplied: ${name}`);
|
if (options && options.required && !val) {
|
||||||
}
|
throw new Error(`Input required and not supplied: ${name}`);
|
||||||
return val.trim();
|
}
|
||||||
}
|
return val.trim();
|
||||||
exports.getInput = getInput;
|
}
|
||||||
/**
|
exports.getInput = getInput;
|
||||||
* Sets the value of an output.
|
/**
|
||||||
*
|
* Sets the value of an output.
|
||||||
* @param name name of the output to set
|
*
|
||||||
* @param value value to store
|
* @param name name of the output to set
|
||||||
*/
|
* @param value value to store
|
||||||
function setOutput(name, value) {
|
*/
|
||||||
command_1.issueCommand('set-output', { name }, value);
|
function setOutput(name, value) {
|
||||||
}
|
command_1.issueCommand('set-output', { name }, value);
|
||||||
exports.setOutput = setOutput;
|
}
|
||||||
//-----------------------------------------------------------------------
|
exports.setOutput = setOutput;
|
||||||
// Results
|
//-----------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------
|
// Results
|
||||||
/**
|
//-----------------------------------------------------------------------
|
||||||
* Sets the action status to failed.
|
/**
|
||||||
* When the action exits it will be with an exit code of 1
|
* Sets the action status to failed.
|
||||||
* @param message add error issue message
|
* When the action exits it will be with an exit code of 1
|
||||||
*/
|
* @param message add error issue message
|
||||||
function setFailed(message) {
|
*/
|
||||||
process.exitCode = ExitCode.Failure;
|
function setFailed(message) {
|
||||||
error(message);
|
process.exitCode = ExitCode.Failure;
|
||||||
}
|
error(message);
|
||||||
exports.setFailed = setFailed;
|
}
|
||||||
//-----------------------------------------------------------------------
|
exports.setFailed = setFailed;
|
||||||
// Logging Commands
|
//-----------------------------------------------------------------------
|
||||||
//-----------------------------------------------------------------------
|
// Logging Commands
|
||||||
/**
|
//-----------------------------------------------------------------------
|
||||||
* Writes debug message to user log
|
/**
|
||||||
* @param message debug message
|
* Writes debug message to user log
|
||||||
*/
|
* @param message debug message
|
||||||
function debug(message) {
|
*/
|
||||||
command_1.issueCommand('debug', {}, message);
|
function debug(message) {
|
||||||
}
|
command_1.issueCommand('debug', {}, message);
|
||||||
exports.debug = debug;
|
}
|
||||||
/**
|
exports.debug = debug;
|
||||||
* Adds an error issue
|
/**
|
||||||
* @param message error issue message
|
* Adds an error issue
|
||||||
*/
|
* @param message error issue message
|
||||||
function error(message) {
|
*/
|
||||||
command_1.issue('error', message);
|
function error(message) {
|
||||||
}
|
command_1.issue('error', message);
|
||||||
exports.error = error;
|
}
|
||||||
/**
|
exports.error = error;
|
||||||
* Adds an warning issue
|
/**
|
||||||
* @param message warning issue message
|
* Adds an warning issue
|
||||||
*/
|
* @param message warning issue message
|
||||||
function warning(message) {
|
*/
|
||||||
command_1.issue('warning', message);
|
function warning(message) {
|
||||||
}
|
command_1.issue('warning', message);
|
||||||
exports.warning = warning;
|
}
|
||||||
/**
|
exports.warning = warning;
|
||||||
* Begin an output group.
|
/**
|
||||||
*
|
* Writes info to log with console.log.
|
||||||
* Output until the next `groupEnd` will be foldable in this group
|
* @param message info message
|
||||||
*
|
*/
|
||||||
* @param name The name of the output group
|
function info(message) {
|
||||||
*/
|
process.stdout.write(message + os.EOL);
|
||||||
function startGroup(name) {
|
}
|
||||||
command_1.issue('group', name);
|
exports.info = info;
|
||||||
}
|
/**
|
||||||
exports.startGroup = startGroup;
|
* Begin an output group.
|
||||||
/**
|
*
|
||||||
* End an output group.
|
* Output until the next `groupEnd` will be foldable in this group
|
||||||
*/
|
*
|
||||||
function endGroup() {
|
* @param name The name of the output group
|
||||||
command_1.issue('endgroup');
|
*/
|
||||||
}
|
function startGroup(name) {
|
||||||
exports.endGroup = endGroup;
|
command_1.issue('group', name);
|
||||||
/**
|
}
|
||||||
* Wrap an asynchronous function call in a group.
|
exports.startGroup = startGroup;
|
||||||
*
|
/**
|
||||||
* Returns the same type as the function itself.
|
* End an output group.
|
||||||
*
|
*/
|
||||||
* @param name The name of the group
|
function endGroup() {
|
||||||
* @param fn The function to wrap in the group
|
command_1.issue('endgroup');
|
||||||
*/
|
}
|
||||||
function group(name, fn) {
|
exports.endGroup = endGroup;
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
/**
|
||||||
startGroup(name);
|
* Wrap an asynchronous function call in a group.
|
||||||
let result;
|
*
|
||||||
try {
|
* Returns the same type as the function itself.
|
||||||
result = yield fn();
|
*
|
||||||
}
|
* @param name The name of the group
|
||||||
finally {
|
* @param fn The function to wrap in the group
|
||||||
endGroup();
|
*/
|
||||||
}
|
function group(name, fn) {
|
||||||
return result;
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
});
|
startGroup(name);
|
||||||
}
|
let result;
|
||||||
exports.group = group;
|
try {
|
||||||
|
result = yield fn();
|
||||||
|
}
|
||||||
|
finally {
|
||||||
|
endGroup();
|
||||||
|
}
|
||||||
|
return result;
|
||||||
|
});
|
||||||
|
}
|
||||||
|
exports.group = group;
|
||||||
//# sourceMappingURL=core.js.map
|
//# sourceMappingURL=core.js.map
|
||||||
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;A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;;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"}
|
||||||
69
node_modules/@actions/core/package.json
generated
vendored
69
node_modules/@actions/core/package.json
generated
vendored
@@ -1,15 +1,41 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/core",
|
"_args": [
|
||||||
"version": "1.1.0",
|
[
|
||||||
"description": "Actions core lib",
|
"@actions/core@1.1.1",
|
||||||
"keywords": [
|
"/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo"
|
||||||
"github",
|
]
|
||||||
"actions",
|
|
||||||
"core"
|
|
||||||
],
|
],
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/core",
|
"_from": "@actions/core@1.1.1",
|
||||||
"license": "MIT",
|
"_id": "@actions/core@1.1.1",
|
||||||
"main": "lib/core.js",
|
"_inBundle": false,
|
||||||
|
"_integrity": "sha512-O5G6EmlzTVsng7VSpNtszIoQq6kOgMGNTFB/hmwKNNA4V71JyxImCIrL27vVHCt2Cb3ImkaCr6o27C2MV9Ylwg==",
|
||||||
|
"_location": "/@actions/core",
|
||||||
|
"_phantomChildren": {},
|
||||||
|
"_requested": {
|
||||||
|
"type": "version",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@actions/core@1.1.1",
|
||||||
|
"name": "@actions/core",
|
||||||
|
"escapedName": "@actions%2fcore",
|
||||||
|
"scope": "@actions",
|
||||||
|
"rawSpec": "1.1.1",
|
||||||
|
"saveSpec": null,
|
||||||
|
"fetchSpec": "1.1.1"
|
||||||
|
},
|
||||||
|
"_requiredBy": [
|
||||||
|
"/",
|
||||||
|
"/@actions/tool-cache"
|
||||||
|
],
|
||||||
|
"_resolved": "https://registry.npmjs.org/@actions/core/-/core-1.1.1.tgz",
|
||||||
|
"_spec": "1.1.1",
|
||||||
|
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo",
|
||||||
|
"bugs": {
|
||||||
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
|
},
|
||||||
|
"description": "Actions core lib",
|
||||||
|
"devDependencies": {
|
||||||
|
"@types/node": "^12.0.2"
|
||||||
|
},
|
||||||
"directories": {
|
"directories": {
|
||||||
"lib": "lib",
|
"lib": "lib",
|
||||||
"test": "__tests__"
|
"test": "__tests__"
|
||||||
@@ -17,6 +43,15 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"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": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
@@ -28,15 +63,5 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"version": "1.1.1"
|
||||||
"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"
|
|
||||||
}
|
|
||||||
|
|||||||
68
node_modules/@actions/exec/package.json
generated
vendored
68
node_modules/@actions/exec/package.json
generated
vendored
@@ -1,39 +1,15 @@
|
|||||||
{
|
{
|
||||||
"_from": "@actions/exec",
|
"name": "@actions/exec",
|
||||||
"_id": "@actions/exec@1.0.1",
|
"version": "1.0.1",
|
||||||
"_inBundle": false,
|
|
||||||
"_integrity": "sha512-nvFkxwiicvpzNiCBF4wFBDfnBvi7xp/as7LE1hBxBxKG2L29+gkIPBiLKMVORL+Hg3JNf07AKRfl0V5djoypjQ==",
|
|
||||||
"_location": "/@actions/exec",
|
|
||||||
"_phantomChildren": {},
|
|
||||||
"_requested": {
|
|
||||||
"type": "tag",
|
|
||||||
"registry": true,
|
|
||||||
"raw": "@actions/exec",
|
|
||||||
"name": "@actions/exec",
|
|
||||||
"escapedName": "@actions%2fexec",
|
|
||||||
"scope": "@actions",
|
|
||||||
"rawSpec": "",
|
|
||||||
"saveSpec": null,
|
|
||||||
"fetchSpec": "latest"
|
|
||||||
},
|
|
||||||
"_requiredBy": [
|
|
||||||
"#USER",
|
|
||||||
"/",
|
|
||||||
"/@actions/tool-cache"
|
|
||||||
],
|
|
||||||
"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.1.tgz",
|
|
||||||
"_shasum": "1624b541165697e7008d7c87bc1f69f191263c6c",
|
|
||||||
"_spec": "@actions/exec",
|
|
||||||
"_where": "/Users/iris/Documents/repos/github.com/peaceiris/actions-hugo",
|
|
||||||
"bugs": {
|
|
||||||
"url": "https://github.com/actions/toolkit/issues"
|
|
||||||
},
|
|
||||||
"bundleDependencies": false,
|
|
||||||
"deprecated": false,
|
|
||||||
"description": "Actions exec lib",
|
"description": "Actions exec lib",
|
||||||
"devDependencies": {
|
"keywords": [
|
||||||
"@actions/io": "^1.0.1"
|
"github",
|
||||||
},
|
"actions",
|
||||||
|
"exec"
|
||||||
|
],
|
||||||
|
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
||||||
|
"license": "MIT",
|
||||||
|
"main": "lib/exec.js",
|
||||||
"directories": {
|
"directories": {
|
||||||
"lib": "lib",
|
"lib": "lib",
|
||||||
"test": "__tests__"
|
"test": "__tests__"
|
||||||
@@ -41,16 +17,6 @@
|
|||||||
"files": [
|
"files": [
|
||||||
"lib"
|
"lib"
|
||||||
],
|
],
|
||||||
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52",
|
|
||||||
"homepage": "https://github.com/actions/toolkit/tree/master/packages/exec",
|
|
||||||
"keywords": [
|
|
||||||
"github",
|
|
||||||
"actions",
|
|
||||||
"exec"
|
|
||||||
],
|
|
||||||
"license": "MIT",
|
|
||||||
"main": "lib/exec.js",
|
|
||||||
"name": "@actions/exec",
|
|
||||||
"publishConfig": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
@@ -62,5 +28,15 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"version": "1.0.1"
|
"bugs": {
|
||||||
}
|
"url": "https://github.com/actions/toolkit/issues"
|
||||||
|
},
|
||||||
|
"devDependencies": {
|
||||||
|
"@actions/io": "^1.0.1"
|
||||||
|
},
|
||||||
|
"gitHead": "a2ab4bcf78e4f7080f0d45856e6eeba16f0bbc52"
|
||||||
|
|
||||||
|
,"_resolved": "https://registry.npmjs.org/@actions/exec/-/exec-1.0.1.tgz"
|
||||||
|
,"_integrity": "sha512-nvFkxwiicvpzNiCBF4wFBDfnBvi7xp/as7LE1hBxBxKG2L29+gkIPBiLKMVORL+Hg3JNf07AKRfl0V5djoypjQ=="
|
||||||
|
,"_from": "@actions/exec@1.0.1"
|
||||||
|
}
|
||||||
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
|
```js
|
||||||
const tc = require('@actions/tool-cache');
|
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
|
#### Extract
|
||||||
@@ -22,15 +22,15 @@ These can then be extracted in platform specific ways:
|
|||||||
const tc = require('@actions/tool-cache');
|
const tc = require('@actions/tool-cache');
|
||||||
|
|
||||||
if (process.platform === 'win32') {
|
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');
|
const node12ExtractedFolder = await tc.extractZip(node12Path, 'path/to/extract/to');
|
||||||
|
|
||||||
// Or alternately
|
// 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');
|
const node12ExtractedFolder = await tc.extract7z(node12Path, 'path/to/extract/to');
|
||||||
}
|
}
|
||||||
else {
|
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');
|
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 tc = require('@actions/tool-cache');
|
||||||
const core = require('@actions/core');
|
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 node12ExtractedFolder = await tc.extractTar(node12Path, 'path/to/extract/to');
|
||||||
|
|
||||||
const cachedPath = await tc.cacheDir(node12ExtractedFolder, 'node', '12.7.0');
|
const cachedPath = await tc.cacheDir(node12ExtractedFolder, 'node', '12.7.0');
|
||||||
|
|||||||
15
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
15
node_modules/@actions/tool-cache/lib/tool-cache.js
generated
vendored
@@ -218,12 +218,7 @@ function extractZip(file, dest) {
|
|||||||
yield extractZipWin(file, dest);
|
yield extractZipWin(file, dest);
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
if (process.platform === 'darwin') {
|
yield extractZipNix(file, dest);
|
||||||
yield extractZipDarwin(file, dest);
|
|
||||||
}
|
|
||||||
else {
|
|
||||||
yield extractZipNix(file, dest);
|
|
||||||
}
|
|
||||||
}
|
}
|
||||||
return dest;
|
return dest;
|
||||||
});
|
});
|
||||||
@@ -252,13 +247,7 @@ function extractZipWin(file, dest) {
|
|||||||
}
|
}
|
||||||
function extractZipNix(file, dest) {
|
function extractZipNix(file, dest) {
|
||||||
return __awaiter(this, void 0, void 0, function* () {
|
return __awaiter(this, void 0, void 0, function* () {
|
||||||
const unzipPath = path.join(__dirname, '..', 'scripts', 'externals', 'unzip');
|
const unzipPath = yield io.which('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');
|
|
||||||
yield exec_1.exec(`"${unzipPath}"`, [file], { cwd: dest });
|
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
87
node_modules/@actions/tool-cache/package.json
generated
vendored
87
node_modules/@actions/tool-cache/package.json
generated
vendored
@@ -1,15 +1,48 @@
|
|||||||
{
|
{
|
||||||
"name": "@actions/tool-cache",
|
"_from": "@actions/tool-cache@^1.1.2",
|
||||||
"version": "1.1.1",
|
"_id": "@actions/tool-cache@1.1.2",
|
||||||
"description": "Actions tool-cache lib",
|
"_inBundle": false,
|
||||||
"keywords": [
|
"_integrity": "sha512-IJczPaZr02ECa3Lgws/TJEVco9tjOujiQSZbO3dHuXXjhd5vrUtfOgGwhmz3/f97L910OraPZ8SknofUk6RvOQ==",
|
||||||
"github",
|
"_location": "/@actions/tool-cache",
|
||||||
"actions",
|
"_phantomChildren": {},
|
||||||
"exec"
|
"_requested": {
|
||||||
|
"type": "range",
|
||||||
|
"registry": true,
|
||||||
|
"raw": "@actions/tool-cache@^1.1.2",
|
||||||
|
"name": "@actions/tool-cache",
|
||||||
|
"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",
|
"_resolved": "https://registry.npmjs.org/@actions/tool-cache/-/tool-cache-1.1.2.tgz",
|
||||||
"license": "MIT",
|
"_shasum": "304d44cecb9547324731e03ca004a3905e6530d2",
|
||||||
"main": "lib/tool-cache.js",
|
"_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": {
|
"directories": {
|
||||||
"lib": "lib",
|
"lib": "lib",
|
||||||
"test": "__tests__"
|
"test": "__tests__"
|
||||||
@@ -18,6 +51,15 @@
|
|||||||
"lib",
|
"lib",
|
||||||
"scripts"
|
"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": {
|
"publishConfig": {
|
||||||
"access": "public"
|
"access": "public"
|
||||||
},
|
},
|
||||||
@@ -29,26 +71,5 @@
|
|||||||
"test": "echo \"Error: run tests from root\" && exit 1",
|
"test": "echo \"Error: run tests from root\" && exit 1",
|
||||||
"tsc": "tsc"
|
"tsc": "tsc"
|
||||||
},
|
},
|
||||||
"bugs": {
|
"version": "1.1.2"
|
||||||
"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"
|
|
||||||
}
|
|
||||||
|
|||||||
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.
1178
package-lock.json
generated
1178
package-lock.json
generated
File diff suppressed because it is too large
Load Diff
48
package.json
48
package.json
@@ -1,12 +1,31 @@
|
|||||||
{
|
{
|
||||||
"name": "hugo-action",
|
"name": "hugo-action",
|
||||||
"version": "0.1.0",
|
"version": "2.2.0",
|
||||||
"description": "Hugo setup action",
|
"description": "Hugo setup action",
|
||||||
"main": "index.js",
|
"main": "lib/index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint ./index.js ./get-latest-version.js",
|
"lint": "eslint ./src/**/*.ts",
|
||||||
"test": "jest",
|
"lint:fix": "eslint --fix ./src/**/*.ts",
|
||||||
"build": "npm prune --production"
|
"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": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
@@ -16,7 +35,9 @@
|
|||||||
"GitHub",
|
"GitHub",
|
||||||
"Actions",
|
"Actions",
|
||||||
"JavaScript",
|
"JavaScript",
|
||||||
"Hugo"
|
"TypeScript",
|
||||||
|
"Hugo",
|
||||||
|
"Setup"
|
||||||
],
|
],
|
||||||
"author": "peaceiris",
|
"author": "peaceiris",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
@@ -25,14 +46,23 @@
|
|||||||
},
|
},
|
||||||
"homepage": "https://github.com/peaceiris/actions-hugo#readme",
|
"homepage": "https://github.com/peaceiris/actions-hugo#readme",
|
||||||
"dependencies": {
|
"dependencies": {
|
||||||
"@actions/core": "^1.1.0",
|
"@actions/core": "^1.1.1",
|
||||||
"@actions/exec": "^1.0.1",
|
"@actions/exec": "^1.0.1",
|
||||||
"@actions/io": "^1.0.1",
|
"@actions/io": "^1.0.1",
|
||||||
"@actions/tool-cache": "^1.1.1",
|
"@actions/tool-cache": "^1.1.2",
|
||||||
"xmlhttprequest": "^1.8.0"
|
"xmlhttprequest": "^1.8.0"
|
||||||
},
|
},
|
||||||
"devDependencies": {
|
"devDependencies": {
|
||||||
|
"@types/jest": "^24.0.18",
|
||||||
|
"@types/node": "^12.7.7",
|
||||||
|
"@typescript-eslint/parser": "^2.3.1",
|
||||||
"eslint": "^6.4.0",
|
"eslint": "^6.4.0",
|
||||||
"jest": "^24.9.0"
|
"husky": "^3.0.5",
|
||||||
|
"jest": "^24.9.0",
|
||||||
|
"jest-circus": "^24.9.0",
|
||||||
|
"lint-staged": "^9.3.0",
|
||||||
|
"prettier": "1.18.2",
|
||||||
|
"ts-jest": "^24.1.0",
|
||||||
|
"typescript": "^3.6.3"
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -1,15 +1,15 @@
|
|||||||
const XMLHttpRequest = require("xmlhttprequest").XMLHttpRequest;
|
const XMLHttpRequest = require('xmlhttprequest').XMLHttpRequest;
|
||||||
|
|
||||||
function getLatestVersion() {
|
export default function getLatestVersion(): Promise<string> {
|
||||||
return new Promise((resolve, reject) => {
|
return new Promise((resolve, reject) => {
|
||||||
const xhr = new XMLHttpRequest();
|
const xhr = new XMLHttpRequest();
|
||||||
const url = "https://formulae.brew.sh/api/formula/hugo.json";
|
const url: string = 'https://formulae.brew.sh/api/formula/hugo.json';
|
||||||
xhr.open("GET", url);
|
xhr.open('GET', url);
|
||||||
xhr.send();
|
xhr.send();
|
||||||
xhr.onreadystatechange = function() {
|
xhr.onreadystatechange = function() {
|
||||||
if (xhr.readyState === 4 && xhr.status === 200) {
|
if (xhr.readyState === 4 && xhr.status === 200) {
|
||||||
const result = JSON.parse(xhr.responseText);
|
const result = JSON.parse(xhr.responseText);
|
||||||
const latestVersion = result.versions.stable;
|
const latestVersion: string = result.versions.stable;
|
||||||
resolve(latestVersion);
|
resolve(latestVersion);
|
||||||
} else if (xhr.readyState === 4 && xhr.status !== 200) {
|
} else if (xhr.readyState === 4 && xhr.status !== 200) {
|
||||||
reject(`ERROR: got status ${xhr.status} of ${url}`);
|
reject(`ERROR: got status ${xhr.status} of ${url}`);
|
||||||
@@ -17,5 +17,3 @@ function getLatestVersion() {
|
|||||||
};
|
};
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
module.exports = getLatestVersion;
|
|
||||||
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