Skip to content

Commit 16d1f9b

Browse files
committed
Fix release script
1 parent f31d227 commit 16d1f9b

File tree

2 files changed

+27
-18
lines changed

2 files changed

+27
-18
lines changed

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@
3131
"node-sass": "^3.8.0",
3232
"react": "^15.1.0",
3333
"react-dom": "^15.1.0",
34+
"read": "^1.0.7",
3435
"sass-loader": "^4.0.0",
3536
"semver": "^5.3.0",
3637
"source-map-loader": "^0.1.5",

release.js

Lines changed: 26 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -17,36 +17,44 @@ const project = require('./package.json');
1717
const changelogParser = require('changelog-parser');
1818
const GitHubAPI = require('github');
1919
const path = require('path');
20+
const read = require('read');
2021
const semver = require('semver');
2122

22-
// Read changelog
23-
changelogParser(CHANGELOG, (err, result) => {
24-
if (err) throw err;
23+
let password = '';
2524

26-
let found = false;
27-
for(let elem of result.versions) {
28-
if (elem.version == project.version) {
29-
found = true;
30-
if(!elem.body) {
31-
console.log('Changelog body is required');
32-
process.exit(1);
25+
read({ prompt: `Github password for ${USER}: `, silent: true }, (er, input) => {
26+
password = input;
27+
28+
// Read changelog
29+
changelogParser(CHANGELOG, (err, result) => {
30+
if (err) throw err;
31+
32+
let found = false;
33+
for(let elem of result.versions) {
34+
if (elem.version == project.version) {
35+
found = true;
36+
if(!elem.body) {
37+
console.log('Changelog body is required');
38+
process.exit(1);
39+
}
40+
createRelease(project.version, elem.body);
3341
}
34-
createRelease(project.version, elem.body);
3542
}
36-
}
37-
if(!found) {
38-
console.log(`No changelog found for v${project.version}`);
39-
process.exit(1);
40-
}
43+
if(!found) {
44+
console.log(`No changelog found for v${project.version}`);
45+
process.exit(1);
46+
}
47+
})
4148
})
4249

4350
function createRelease(version, body) {
4451
console.log(`Creating new Github release for v${version}`);
4552
console.log(body);
4653

4754
let auth = {
48-
type: 'oauth',
49-
token: '6c64814fd14fc726673855dfa285f201ac8d93cc',
55+
type: 'basic',
56+
username: USER,
57+
password: password,
5058
};
5159

5260
// Connect to github

0 commit comments

Comments
 (0)