From 843ac84fedc5a2b5433dc1680968193cf98e86c8 Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Sun, 15 Sep 2019 20:24:31 +0900 Subject: [PATCH] add: options hugo-version and extended --- .github/workflows/test.yml | 21 +++++++++++++++++---- action.yml | 8 ++++++++ index.js | 10 ++++++++-- package.json | 5 +++-- 4 files changed, 36 insertions(+), 8 deletions(-) diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index ea9b7f3..5dc1905 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -1,4 +1,4 @@ -name: "Test" +name: 'Test' on: push: @@ -8,11 +8,24 @@ on: jobs: test: runs-on: ubuntu-18.04 + + strategy: + matrix: + hugo-version: ['', 'latest', '0.58.2'] + extended: ['', false, true] + steps: - uses: actions/checkout@v1 + - name: Install dependencies - 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: - milliseconds: 1000 + hugo-version: ${{ matrix.hugo-version }} + extended: ${{ matrix.extended }} + milliseconds: 100 diff --git a/action.yml b/action.yml index cfad6d2..51dcc0b 100644 --- a/action.yml +++ b/action.yml @@ -2,6 +2,14 @@ name: 'Hugo build action' description: 'GitHub Actions for Hugo extended and Hugo Modules' author: 'peaceiris' 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 description: 'number of milliseconds to wait' required: true diff --git a/index.js b/index.js index ee57a25..09d6746 100644 --- a/index.js +++ b/index.js @@ -4,7 +4,7 @@ const wait = require('./wait'); // most @actions toolkit packages have async methods async function run() { - try { + try { const ms = core.getInput('milliseconds'); console.log(`Waiting ${ms} milliseconds ...`) @@ -13,7 +13,13 @@ async function run() { core.debug((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) { core.setFailed(error.message); } diff --git a/package.json b/package.json index d7c5165..dff381d 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,8 @@ "main": "index.js", "scripts": { "lint": "eslint index.js", - "test": "eslint index.js && jest" + "test": "eslint index.js && jest", + "build": "npm prune --production" }, "repository": { "type": "git", @@ -17,7 +18,7 @@ "JavaScript", "Hugo" ], - "author": "GitHub", + "author": "peaceiris", "license": "MIT", "bugs": { "url": "https://github.com/peaceiris/actions-hugo/issues"