question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

documentation for github deploy is wrong.

See original GitHub issue
  1. I fixed the path error, obviously it was for the node path module.
  2. when publishing to git for some reason with the gh-pages branch it deploys an older commit.
tasks.set('publish', () => {
  const remote = {
    url: 'https://github.com/lifeiscontent/OpenPoGoUI.git',
    branch: 'gh-pages',
  };
  global.DEBUG = process.argv.includes('--debug') || false;
  const spawn = require('child_process').spawn;
  const opts = {
    cwd: path.resolve(__dirname, './public'),
    stdio: ['ignore', 'inherit', 'inherit'],
  };

  const git = (...args) => new Promise((resolve, reject) => {
    spawn('git', args, opts).on('close', code => {
      if (code === 0) {
        resolve();
      } else {
        reject(new Error(`git ${args.join(' ')} => ${code} (error)`));
      }
    });
  });

  return Promise.resolve()
    .then(() => run('clean'))
    .then(() => git('init', '--quiet'))
    .then(() => git('config', '--get', 'remote.origin.url')
      .then(() => git('remote', 'set-url', 'origin', remote.url))
      .catch(() => git('remote', 'add', 'origin', remote.url))
    )
    .then(() => git('ls-remote', '--exit-code', remote.url, 'master')
      .then(() => Promise.resolve()
        .then(() => git('fetch', 'origin'))
        .then(() => git('reset', `origin/${remote.branch}`, '--hard'))
        .then(() => git('clean', '--force'))
      )
      .catch(() => Promise.resolve())
    )
    .then(() => run('build'))
    .then(() => git('add', '.', '--all'))
    .then(() => git('commit', '--message', new Date().toUTCString())
      .catch(() => Promise.resolve()))
    .then(() => git('push', 'origin', `HEAD:${remote.branch}`, '--force', '--set-upstream'));
});

here’s the task code.

it seems that my public/index.ejs gets overwritten also.

Issue Analytics

  • State:closed
  • Created 7 years ago
  • Comments:5 (2 by maintainers)

github_iconTop GitHub Comments

3reactions
lifeiscontentcommented, Aug 15, 2016

@koistya here’s the updated task that I am using with the gh-pages npm module.

tasks.set('publish', () => {
  const ghPages = require('gh-pages');
  global.DEBUG = process.argv.includes('--debug') || false;
  const publish = (dir) => new Promise((resolve, reject) => {
    ghPages.publish(dir, {}, (err) => {
      if (err) {
        reject();
      } else {
        resolve();
      }
    });
  });

  return Promise.resolve()
    .then(() => run('clean'))
    .then(() => run('build'))
    .then(() => publish(path.join(__dirname, 'public')));
});
0reactions
koistyacommented, Sep 20, 2016

@josephdburdick what @frenzzy said ^^ Also, take a look at the “baseUrl” property in the “history” module docs.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Build errors during deployment to GitHub Pages · Issue #209
I am failed to deploy the ai-folio theme in my personal repository. Even I don't find any fruitful reason why it is happening....
Read more >
Error when deploying to GitHub Pages · Issue #1803
I get an error, when I try to deploy to GitHub Pages. ... Building documentation to directory: C:\Users\Me\Documents\Git\repo\site WARNING ...
Read more >
About Jekyll build errors for GitHub Pages sites
If Jekyll encounters an error building your GitHub Pages site locally or on GitHub, you'll receive an error message with more information.
Read more >
Configuring a publishing source for your GitHub Pages site
Under "Build and deployment", under "Source", select Deploy from a branch. ... build and you'll get a page build error message for a...
Read more >
Deploy fails with "ERROR: Repository not found." after build.
When I deploy my docusaurus site onto my organizations github I get the following error: ~/catkin_ws/src/nautilus_stack/docs (master) ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found