From d44adaf4fef5fdbbba4024e1b1c70e7cb4b47d25 Mon Sep 17 00:00:00 2001 From: peaceiris <30958501+peaceiris@users.noreply.github.com> Date: Mon, 16 Sep 2019 02:11:19 +0900 Subject: [PATCH] add: sudo mv hugo --- index.js | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/index.js b/index.js index 6c2e13e..2e8340d 100644 --- a/index.js +++ b/index.js @@ -1,6 +1,7 @@ const core = require('@actions/core'); const tc = require('@actions/tool-cache'); const io = require('@actions/io'); +const exec = require('@actions/exec'); // most @actions toolkit packages have async methods @@ -30,15 +31,14 @@ async function run() { const hugoURL = `https://github.com/gohugoio/hugo/releases/download/v${hugoVersion}/${hugoName}.tar.gz`; core.debug('hugoURL:', hugoURL); - const hugoPath = '/github/home/bin'; + const hugoPath = '/usr/local/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); + await exec.exec('sudo', ['mv', `${hugoExtractedFolder}/hugo`, hugoPath]); } catch (error) { core.setFailed(error.message);