forked from pugjs/pug
-
Notifications
You must be signed in to change notification settings - Fork 0
/
release.js
35 lines (30 loc) · 1.09 KB
/
release.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
33
34
35
'use strict';
var fs = require('fs');
var pr = require('pull-request');
var readdirp = require('lsr').sync;
var TOKEN = JSON.parse(fs.readFileSync(__dirname + '/.release.json', 'utf8'));
// todo: check that the version is a new un-released version
// todo: check the user has commit access to the github repo
// todo: check the user is an owner in npm
// todo: check History.md has been updated
var version = require('./package.json').version;
var compiledWebsite = require('./docs/stop.js');
compiledWebsite.then(function () {
var fileUpdates = readdirp(__dirname + '/docs/out').filter(function (info) {
return info.isFile();
}).map(function (info) {
return {
path: info.path.replace(/^\.\//, ''),
content: fs.readFileSync(info.fullPath)
};
});
return pr.commit('jadejs', 'jade', {
branch: 'gh-pages',
message: 'Update website for ' + version,
updates: fileUpdates
}, {auth: {type: 'oauth', token: TOKEN}});
}).then(function () {
// todo: release the new npm package, set the tag and commit etc.
}).done(function () {
console.log('website published');
});