release.js 1.1 KB

1234567891011121314151617181920212223242526272829303132333435
  1. 'use strict';
  2. var fs = require('fs');
  3. var pr = require('pull-request');
  4. var readdirp = require('lsr').sync;
  5. var TOKEN = JSON.parse(fs.readFileSync(__dirname + '/.release.json', 'utf8'));
  6. // todo: check that the version is a new un-released version
  7. // todo: check the user has commit access to the github repo
  8. // todo: check the user is an owner in npm
  9. // todo: check History.md has been updated
  10. var version = require('./package.json').version;
  11. var compiledWebsite = require('./docs/stop.js');
  12. compiledWebsite.then(function () {
  13. var fileUpdates = readdirp(__dirname + '/docs/out').filter(function (info) {
  14. return info.isFile();
  15. }).map(function (info) {
  16. return {
  17. path: info.path.replace(/^\.\//, ''),
  18. content: fs.readFileSync(info.fullPath)
  19. };
  20. });
  21. return pr.commit('jadejs', 'jade', {
  22. branch: 'gh-pages',
  23. message: 'Update website for ' + version,
  24. updates: fileUpdates
  25. }, {auth: {type: 'oauth', token: TOKEN}});
  26. }).then(function () {
  27. // todo: release the new npm package, set the tag and commit etc.
  28. }).done(function () {
  29. console.log('website published');
  30. });