Skip to content

Commit

Permalink
chore(ci): The book should mention the version of the API it documents
Browse files Browse the repository at this point in the history
Experimenting with the semantic-release / gh-pages combo
  • Loading branch information
jan-molak committed Jan 12, 2017
1 parent 9aaa266 commit da182f2
Show file tree
Hide file tree
Showing 3 changed files with 60 additions and 5 deletions.
4 changes: 1 addition & 3 deletions .travis.yml
Expand Up @@ -14,9 +14,7 @@ before_script:
script:
- npm run verify
after_success:
- npm run publish-coverage-report
- npm run publish-book
- npm run semantic-release
- npm run publish
branches:
except:
- /^v\d+\.\d+\.\d+$/
Expand Down
54 changes: 54 additions & 0 deletions gh-pages.js
@@ -0,0 +1,54 @@
var ghpages = require('gh-pages');
var program = require('commander');
var path = require('path');

program
.option('-d, --dist <dist>',
'base directory for all source files')
.option('-s, --src <src>',
'pattern used to select which files should be published', '**/*')
.option('-r, --repo <repo>',
'URL of the repository you\'ll be pushing to')
.option('-x, --silent', 'Do not output the repository url')
.option('-b, --branch <branch>',
'name of the branch you\'ll be pushing to', 'gh-pages')
.option('-o, --remote <name>',
'The name of the remote', 'origin')
.option('-m, --message <message>',
'commit message', 'Updates')
.option('-g, --tag <tag>',
'add tag to commit')
.option('-t, --dotfiles', 'Include dotfiles')
.option('-a, --add', 'Only add, and never remove existing files.')
.option('-v, --remove <pattern>',
'Remove files that match the given pattern ' +
'(ignored if used together with --add).', '.')
.option('-n, --no-push', 'Commit only (with no push)')
.parse(process.argv);

ghpages.publish(path.join(process.cwd(), program.dist), {
repo: program.repo,
silent: !!program.silent,
branch: program.branch,
src: program.src,
message: program.message,
tag: program.tag,
dotfiles: !!program.dotfiles,
add: !!program.add,
only: program.remove,
remote: program.remote,
push: !program.noPush,
user: {
name: 'Jan Molak',
email: 'jan.molak@smartcodeltd.co.uk'
},
logger: function(message) {
process.stderr.write(message + '\n');
}
}, function(err) {
if (err) {
process.stderr.write(err.message + '\n');
return process.exit(1);
}
process.stderr.write('Published\n');
});
7 changes: 5 additions & 2 deletions package.json
Expand Up @@ -26,8 +26,10 @@
"coverage:report": "nyc report --reporter=html --reporter=lcov --temp-directory=./staging/reports/coverage --report-dir=./staging/reports/coverage",
"report": "npm run coverage:merge && npm run coverage:report",
"publish-coverage-report": "cat ./staging/reports/coverage/lcov.info | node ./node_modules/coveralls/bin/coveralls.js",
"publish-book": "rimraf _book && gitbook build && gh-pages -d _book",
"semantic-release": "semantic-release pre && npm publish && semantic-release post"
"semantic-release": "semantic-release pre && npm publish && semantic-release post",
"book:build": "rimraf _book && gitbook build",
"book:publish": "node ./gh-pages.js -d _book",
"publish": "failsafe publish-coverage-report semantic-release book:build book:publish"
},
"peerDependencies": {
"protractor": ">= 4.0.10 < 5"
Expand Down Expand Up @@ -82,6 +84,7 @@
"mocha": "3.2.0",
"mock-fs": "4.0.0-beta.1",
"nock": "8.0.0",
"npm-failsafe": "0.2.1",
"nyc": "10.0.0",
"phantomjs-prebuilt": "2.1.14",
"protractor": "4.0.14",
Expand Down

0 comments on commit da182f2

Please sign in to comment.