From 38e9e1525a584bd7d6626a1b55230330377db196 Mon Sep 17 00:00:00 2001 From: CrazyMax Date: Fri, 15 Nov 2019 16:29:46 +0100 Subject: [PATCH] Fix build dir --- lib/main.js | 7 ++++--- src/main.ts | 7 ++++--- 2 files changed, 8 insertions(+), 6 deletions(-) diff --git a/lib/main.js b/lib/main.js index 02f71fe..1a66444 100644 --- a/lib/main.js +++ b/lib/main.js @@ -58,9 +58,10 @@ function run() { } remote_url = remote_url.concat('@github.com/', repo, '.git'); const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'github-pages-')); + const currentdir = path.resolve('.'); process.chdir(tmpdir); - core.info(`🏃 Copying ${path.resolve(build_dir)} contents to ${tmpdir}`); - fs_extra_1.copySync(path.resolve(build_dir), tmpdir); + core.info(`🏃 Copying ${path.join(currentdir, build_dir)} contents to ${tmpdir}`); + fs_extra_1.copySync(path.join(currentdir, build_dir), tmpdir); const remote_branch_exists = child_process.execSync(`git ls-remote --heads ${remote_url} ${target_branch}`, { encoding: 'utf8' }).trim().length > 0; if (remote_branch_exists) { @@ -100,7 +101,7 @@ function run() { gitPushCmd.push(remote_url, target_branch); core.info(`🏃 Deploying ${build_dir} directory to ${target_branch} branch on ${repo} repo`); yield exec.exec('git', gitPushCmd); - process.chdir(process.env['GITHUB_WORKSPACE'] || '.'); + process.chdir(currentdir); core.info(`🎉 Content of ${build_dir} has been deployed to GitHub Pages.`); } catch (error) { diff --git a/src/main.ts b/src/main.ts index e4fc90e..62b312a 100644 --- a/src/main.ts +++ b/src/main.ts @@ -42,10 +42,11 @@ async function run() { remote_url = remote_url.concat('@github.com/', repo, '.git'); const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'github-pages-')); + const currentdir = path.resolve('.'); process.chdir(tmpdir); - core.info(`🏃 Copying ${path.resolve(build_dir)} contents to ${tmpdir}`); - copySync(path.resolve(build_dir), tmpdir); + core.info(`🏃 Copying ${path.join(currentdir, build_dir)} contents to ${tmpdir}`); + copySync(path.join(currentdir, build_dir), tmpdir); const remote_branch_exists = child_process.execSync(`git ls-remote --heads ${remote_url} ${target_branch}`, {encoding: 'utf8'}).trim().length > @@ -93,7 +94,7 @@ async function run() { core.info(`🏃 Deploying ${build_dir} directory to ${target_branch} branch on ${repo} repo`); await exec.exec('git', gitPushCmd); - process.chdir(process.env['GITHUB_WORKSPACE'] || '.'); + process.chdir(currentdir); core.info(`🎉 Content of ${build_dir} has been deployed to GitHub Pages.`); } catch (error) { core.setFailed(error.message);