add: core.addPath()

This commit is contained in:
peaceiris 2019-09-16 02:06:57 +09:00
parent 349881b966
commit 9e04da8578
2 changed files with 6 additions and 12 deletions

View file

@ -31,6 +31,8 @@ jobs:
- name: Dump - name: Dump
run: | run: |
ls -la /usr/local/bin echo ${HOME}
ls -la ${HOME}
ls -la
echo ${PATH} echo ${PATH}
hugo version hugo version

View file

@ -1,22 +1,11 @@
const core = require('@actions/core'); const core = require('@actions/core');
// const exec = require('@actions/exec');
const tc = require('@actions/tool-cache'); const tc = require('@actions/tool-cache');
const io = require('@actions/io'); const io = require('@actions/io');
// 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');
// console.log(`Waiting ${ms} milliseconds ...`)
// core.debug((new Date()).toTimeString())
// wait(parseInt(ms));
// core.debug((new Date()).toTimeString())
// core.setOutput('time', new Date().toTimeString());
let hugoVersion = core.getInput('hugo-version'); let hugoVersion = core.getInput('hugo-version');
if (!hugoVersion) { if (!hugoVersion) {
// TODO: get latest version of Hugo // TODO: get latest version of Hugo
@ -43,6 +32,9 @@ async function run() {
const hugoPath = '/github/home/bin'; const hugoPath = '/github/home/bin';
await io.mkdirP(hugoPath); await io.mkdirP(hugoPath);
core.addPath(hugoPath);
// Download and extract Hugo binary
const hugoTarball = await tc.downloadTool(hugoURL); const hugoTarball = await tc.downloadTool(hugoURL);
const hugoExtractedFolder = await tc.extractTar(hugoTarball, '/tmp'); const hugoExtractedFolder = await tc.extractTar(hugoTarball, '/tmp');
core.debug('hugoExtractedFolder:', hugoExtractedFolder); core.debug('hugoExtractedFolder:', hugoExtractedFolder);