add: options hugo-version and extended
This commit is contained in:
parent
42a06b08e9
commit
843ac84fed
4 changed files with 36 additions and 8 deletions
21
.github/workflows/test.yml
vendored
21
.github/workflows/test.yml
vendored
|
@ -1,4 +1,4 @@
|
||||||
name: "Test"
|
name: 'Test'
|
||||||
|
|
||||||
on:
|
on:
|
||||||
push:
|
push:
|
||||||
|
@ -8,11 +8,24 @@ on:
|
||||||
jobs:
|
jobs:
|
||||||
test:
|
test:
|
||||||
runs-on: ubuntu-18.04
|
runs-on: ubuntu-18.04
|
||||||
|
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
hugo-version: ['', 'latest', '0.58.2']
|
||||||
|
extended: ['', false, true]
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v1
|
- uses: actions/checkout@v1
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
- run: npm ci
|
- run: npm ci
|
||||||
- run: npm test
|
|
||||||
- uses: peaceiris/actions-hugo@migrate-javascript-action
|
# - name: Test script
|
||||||
|
# - run: npm test
|
||||||
|
|
||||||
|
- name: Test action
|
||||||
|
uses: peaceiris/actions-hugo@migrate-javascript-action
|
||||||
with:
|
with:
|
||||||
milliseconds: 1000
|
hugo-version: ${{ matrix.hugo-version }}
|
||||||
|
extended: ${{ matrix.extended }}
|
||||||
|
milliseconds: 100
|
||||||
|
|
|
@ -2,6 +2,14 @@ name: 'Hugo build action'
|
||||||
description: 'GitHub Actions for Hugo extended and Hugo Modules'
|
description: 'GitHub Actions for Hugo extended and Hugo Modules'
|
||||||
author: 'peaceiris'
|
author: 'peaceiris'
|
||||||
inputs:
|
inputs:
|
||||||
|
hugo-version:
|
||||||
|
description: 'The Hugo version to download (if necessary) and use. Example: 0.58.2'
|
||||||
|
required: false
|
||||||
|
default: 'latest'
|
||||||
|
extended:
|
||||||
|
description: 'Download (if necessary) and use Hugo extended version. Example: true'
|
||||||
|
required: false
|
||||||
|
default: 'false'
|
||||||
milliseconds: # id of input
|
milliseconds: # id of input
|
||||||
description: 'number of milliseconds to wait'
|
description: 'number of milliseconds to wait'
|
||||||
required: true
|
required: true
|
||||||
|
|
10
index.js
10
index.js
|
@ -4,7 +4,7 @@ const wait = require('./wait');
|
||||||
|
|
||||||
// most @actions toolkit packages have async methods
|
// most @actions toolkit packages have async methods
|
||||||
async function run() {
|
async function run() {
|
||||||
try {
|
try {
|
||||||
const ms = core.getInput('milliseconds');
|
const ms = core.getInput('milliseconds');
|
||||||
console.log(`Waiting ${ms} milliseconds ...`)
|
console.log(`Waiting ${ms} milliseconds ...`)
|
||||||
|
|
||||||
|
@ -13,7 +13,13 @@ async function run() {
|
||||||
core.debug((new Date()).toTimeString())
|
core.debug((new Date()).toTimeString())
|
||||||
|
|
||||||
core.setOutput('time', new Date().toTimeString());
|
core.setOutput('time', new Date().toTimeString());
|
||||||
}
|
|
||||||
|
const hugoVersion = core.getInput('hugo-version');
|
||||||
|
console.log('Hugo version:', hugoVersion);
|
||||||
|
|
||||||
|
const extended = core.getInput('extended');
|
||||||
|
console.log('Hugo extended:', extended);
|
||||||
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
}
|
}
|
||||||
|
|
|
@ -5,7 +5,8 @@
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"lint": "eslint index.js",
|
"lint": "eslint index.js",
|
||||||
"test": "eslint index.js && jest"
|
"test": "eslint index.js && jest",
|
||||||
|
"build": "npm prune --production"
|
||||||
},
|
},
|
||||||
"repository": {
|
"repository": {
|
||||||
"type": "git",
|
"type": "git",
|
||||||
|
@ -17,7 +18,7 @@
|
||||||
"JavaScript",
|
"JavaScript",
|
||||||
"Hugo"
|
"Hugo"
|
||||||
],
|
],
|
||||||
"author": "GitHub",
|
"author": "peaceiris",
|
||||||
"license": "MIT",
|
"license": "MIT",
|
||||||
"bugs": {
|
"bugs": {
|
||||||
"url": "https://github.com/peaceiris/actions-hugo/issues"
|
"url": "https://github.com/peaceiris/actions-hugo/issues"
|
||||||
|
|
Loading…
Reference in a new issue