-
Notifications
You must be signed in to change notification settings - Fork 110
/
deploy.js
32 lines (25 loc) · 887 Bytes
/
deploy.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
/**
* Helper script for building and deploying
* Deploys out of /dist/
*
* - Deploys to package.json.deploy.repo
* - Domain is set to package.json.deploy.url
*/
// build
const pkg = require('./package.json')
const gitRepo = pkg.deploy.repo
const domainName = pkg.deploy.domain
const shell = require('shelljs')
// navigate into the build output directory
shell.cd('dist/sandbox')
// if you are deploying to a custom domain
shell.exec(`echo ${domainName} > CNAME`)
shell.exec('git init')
shell.exec('git add -A')
shell.exec(`git commit -m "deploy docs for ${pkg.version}"`)
// if you are deploying to https://<USERNAME>.github.io
// git push -f [email protected]:<USERNAME>/<USERNAME>.github.io.git master
// if you are deploying to https://<USERNAME>.github.io/<REPO>
shell.exec(`git remote add origin ${gitRepo}`)
shell.exec('git push origin master:gh-pages -f')
shell.cd('-')