tschaub/gh-pages

use of GH_TOKEN in .env file with gh-pages -d

blurymind opened this issue · 1 comments

As you probably know github no longer accepts passwords, which completely breaks the use of gh-pages -d dist

Yet gh-pages will still ask you to enter a username and a password,only to then give you an error to tell you this no longer can be accepted. It seems like a bug now.

My question here is this - if say I have a .env file in the same folder as the package.json with that gh-pages -d dist script, why can't we have gh-pages automatically pick my token from the env file and just do its job?

It doesnt seem to have anything in place that would let me continue doing it from package.json, so can you point me to some example? A script perhaps that uses a token?

This doesnt seem to work

ghpages.publish('dist', {
  repo: 'https://' + process.env.GH_TOKEN + '@github.com/user/private-repo.git',
  silent: true
}, callback);

you get

Error: Remote url mismatch.  Got "https://github.com/blurymind/tilemap-editor.git" but expected "https://ghp_xxxxxxxxxxqRNJ7kpEM5lbCI8kDtU4HssCG@github.com/blurymind/tilemap-editor.git" in /home/fox/DEV/tilemap-editor/node_modules/.cache/gh-pages/github.com!blurymind!tilemap-editor.git.  Try running the `gh-pages-clean` script first.
    at /home/fox/DEV/tilemap-editor/node_modules/gh-pages/lib/index.js:130:19

Process finished with exit code 0

this is the deploy script I tried (process.env.GH_TOKEN was not getting picked from the .env file which is another issue)

const ghpages = require('gh-pages');

//https://github.com/blurymind/tilemap-editor.git
ghpages.publish('.', {
    repo: 'https://' + "ghp_xxxxxxxxxxxxxxxkpEM5lbCI8kDtU4HssCG" + '@github.com/blurymind/tilemap-editor.git',
    // silent: true
}, console.log);

I use gh-pages for
https://github.com/blurymind/tilemap-editor
https://github.com/YarnSpinnerTool/YarnEditor

the deployment for both broke

@blurymind JFYI and maybe you have something to add to #413