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 d90aa76
Show file tree
Hide file tree
Showing 4 changed files with 60 additions and 9 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
4 changes: 0 additions & 4 deletions book/readme.md
Expand Up @@ -37,7 +37,3 @@ or get your hands dirty with [the tutorial](from-scripts-to-serenity/readme.md)!
<a class="image" href="https://david-dm.org/jan-molak/serenity-js" target="_blank"><img src="https://david-dm.org/jan-molak/serenity-js.svg" alt="Dependencies"></a>
<a class="image" href="https://github.com/semantic-release/semantic-release" target="_blank"><img src="https://img.shields.io/badge/%20%20%F0%9F%93%A6%F0%9F%9A%80-semantic--release-e10079.svg" alt="semantic-release"></a>
</p>

_Serenity/JS Handbook was generated on the {{ gitbook.time | date('Do of MMMM YYYY') }}
and covers Serenity/JS version
[{{ book.api_version }}](https://github.com/jan-molak/serenity-js/releases/tag/v{{ book.api_version }})._
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: 'https://' + process.env.GH_TOKEN + '@github.com/jan-molak/serenity-js.git',
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: 'Travis CI',
email: 'travis@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 d90aa76

Please sign in to comment.