Fix build dir
This commit is contained in:
parent
e6b7b7a697
commit
38e9e1525a
|
@ -58,9 +58,10 @@ function run() {
|
||||||
}
|
}
|
||||||
remote_url = remote_url.concat('@github.com/', repo, '.git');
|
remote_url = remote_url.concat('@github.com/', repo, '.git');
|
||||||
const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'github-pages-'));
|
const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'github-pages-'));
|
||||||
|
const currentdir = path.resolve('.');
|
||||||
process.chdir(tmpdir);
|
process.chdir(tmpdir);
|
||||||
core.info(`🏃 Copying ${path.resolve(build_dir)} contents to ${tmpdir}`);
|
core.info(`🏃 Copying ${path.join(currentdir, build_dir)} contents to ${tmpdir}`);
|
||||||
fs_extra_1.copySync(path.resolve(build_dir), 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 >
|
const remote_branch_exists = child_process.execSync(`git ls-remote --heads ${remote_url} ${target_branch}`, { encoding: 'utf8' }).trim().length >
|
||||||
0;
|
0;
|
||||||
if (remote_branch_exists) {
|
if (remote_branch_exists) {
|
||||||
|
@ -100,7 +101,7 @@ function run() {
|
||||||
gitPushCmd.push(remote_url, target_branch);
|
gitPushCmd.push(remote_url, target_branch);
|
||||||
core.info(`🏃 Deploying ${build_dir} directory to ${target_branch} branch on ${repo} repo`);
|
core.info(`🏃 Deploying ${build_dir} directory to ${target_branch} branch on ${repo} repo`);
|
||||||
yield exec.exec('git', gitPushCmd);
|
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.`);
|
core.info(`🎉 Content of ${build_dir} has been deployed to GitHub Pages.`);
|
||||||
}
|
}
|
||||||
catch (error) {
|
catch (error) {
|
||||||
|
|
|
@ -42,10 +42,11 @@ async function run() {
|
||||||
remote_url = remote_url.concat('@github.com/', repo, '.git');
|
remote_url = remote_url.concat('@github.com/', repo, '.git');
|
||||||
|
|
||||||
const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'github-pages-'));
|
const tmpdir = fs.mkdtempSync(path.join(os.tmpdir(), 'github-pages-'));
|
||||||
|
const currentdir = path.resolve('.');
|
||||||
process.chdir(tmpdir);
|
process.chdir(tmpdir);
|
||||||
|
|
||||||
core.info(`🏃 Copying ${path.resolve(build_dir)} contents to ${tmpdir}`);
|
core.info(`🏃 Copying ${path.join(currentdir, build_dir)} contents to ${tmpdir}`);
|
||||||
copySync(path.resolve(build_dir), tmpdir);
|
copySync(path.join(currentdir, build_dir), tmpdir);
|
||||||
|
|
||||||
const remote_branch_exists =
|
const remote_branch_exists =
|
||||||
child_process.execSync(`git ls-remote --heads ${remote_url} ${target_branch}`, {encoding: 'utf8'}).trim().length >
|
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`);
|
core.info(`🏃 Deploying ${build_dir} directory to ${target_branch} branch on ${repo} repo`);
|
||||||
await exec.exec('git', gitPushCmd);
|
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.`);
|
core.info(`🎉 Content of ${build_dir} has been deployed to GitHub Pages.`);
|
||||||
} catch (error) {
|
} catch (error) {
|
||||||
core.setFailed(error.message);
|
core.setFailed(error.message);
|
||||||
|
|
Loading…
Reference in New Issue
Block a user