Skip to content

Commit

Permalink
chore: auto-update gh-pages
Browse files Browse the repository at this point in the history
  • Loading branch information
justmoon committed May 28, 2016
1 parent ed45e70 commit 572ff4d
Show file tree
Hide file tree
Showing 4 changed files with 37 additions and 3 deletions.
3 changes: 2 additions & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
node_modules/
/coverage/
/npm-debug.log
/docs-out/
/jsdoc-out/
/web/
2 changes: 1 addition & 1 deletion jsdoc.json
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
"plugins": ["plugins/markdown"],
"opts": {
"template": "node_modules/interledger-jsdoc-template",
"destination": "./docs-out/",
"destination": "./jsdoc-out/",
"readme": "./README.md",
"reponame": "Five Bells Shared"
}
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
"scripts": {
"lint": "eslint .",
"test": "istanbul test -- _mocha",
"jsdoc": "jsdoc -R README.md -c jsdoc.json lib/* && cp -r docs docs-out",
"jsdoc": "jsdoc -R README.md -c jsdoc.json lib/* && cp -r docs jsdoc-out",
"bump": "./bin/bump.sh",
"ci-publish": "./bin/ci-publish.sh"
},
Expand Down
33 changes: 33 additions & 0 deletions scripts/publish_web.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
#!/usr/bin/env node

'use strict'

const path = require('path')
const exec = require('child_process').execSync

let cwd = path.resolve(__dirname, '..')

// Get current web branch
console.log('\n# Cloning web branch')
exec('rm -rf web', { cwd })
exec('git clone git@github.com:interledger/five-bells-shared.git --branch gh-pages --single-branch web', { cwd })

// Update jsdoc
console.log('\n# Updating API docs')
exec('npm run jsdoc', { cwd })
exec('mkdir -p web/jsdoc', { cwd })
exec('cp -r jsdoc-out/* web/jsdoc/', { cwd })

// Push changes
cwd = path.resolve(cwd, 'web')
console.log('\n# Pushing web branch')
exec('git add --all', { cwd })

const status = exec('git status --porcelain', { cwd }).toString('utf8')
if (!status.length) {
console.log('no changes')
} else {
console.log(status)
exec('git commit -m \'chore: update gh-pages\'', { cwd })
exec('git push', { cwd })
}

0 comments on commit 572ff4d

Please sign in to comment.