/ bin / gh-pages.js
gh-pages.js
 1  const { promisify } = require('util')
 2  const { publish } = require('gh-pages')
 3  const ghpublish = promisify(publish)
 4  
 5  /* fix for "Unhandled promise rejections" */
 6  process.on('unhandledRejection', err => { throw err })
 7  
 8  const branch = 'gh-pages'
 9  /* use SSH auth by default */
10  let url = 'git@github.com:status-im/analytics.status.im.git'
11  
12  /* alternative is to use github used and API token */
13  if (process.env.GH_USER != undefined) {
14    url = ( 
15      'https://' + process.env.GH_USER + ':' + process.env.GH_TOKEN
16      + '@github.com/status-im/analytics.status.im.git'
17    )
18  }
19  
20  const main = async (url, branch)=> {
21    console.log(`Pushing to: ${url}`)
22    console.log(`On branch: ${branch}`)
23    await ghpublish('public', {
24      repo: url,
25      branch: branch,
26      dotfiles: true,
27      silent: false
28    })
29  }
30  
31  main(url, branch)