Skip to content

Commit c23bbb4

Browse files
committed
Streamline releases
1 parent 47d4762 commit c23bbb4

File tree

3 files changed

+21
-31
lines changed

3 files changed

+21
-31
lines changed

.gitignore

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -41,3 +41,6 @@ lib
4141

4242
# mocha-webpack cache
4343
.tmp
44+
45+
# github token
46+
.token.json

package.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,6 @@
5252
"react": "^15.1.0",
5353
"react-addons-test-utils": "^15.3.0",
5454
"react-dom": "^15.1.0",
55-
"read": "^1.0.7",
5655
"sass-loader": "^4.0.0",
5756
"semver": "^5.3.0",
5857
"source-map-loader": "^0.1.5",

release.js

Lines changed: 18 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -12,54 +12,42 @@ const ASSETS = [
1212
'dist/dist-min.zip',
1313
];
1414

15+
const token = require('./.token.json');
1516
const project = require('./package.json');
1617

1718
const changelogParser = require('changelog-parser');
1819
const GitHubAPI = require('github');
1920
const path = require('path');
20-
const read = require('read');
2121
const semver = require('semver');
2222

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

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);
27+
let found = false;
28+
for(let elem of result.versions) {
29+
if (elem.version == project.version) {
30+
found = true;
31+
if(!elem.body) {
32+
console.log('Changelog body is required');
33+
process.exit(1);
4134
}
35+
createRelease(project.version, elem.body);
4236
}
43-
if(!found) {
44-
console.log(`No changelog found for v${project.version}`);
45-
process.exit(1);
46-
}
47-
})
37+
}
38+
if(!found) {
39+
console.log(`No changelog found for v${project.version}`);
40+
process.exit(1);
41+
}
4842
})
4943

5044
function createRelease(version, body) {
5145
console.log(`Creating new Github release for v${version}`);
5246
console.log(body);
5347

54-
let auth = {
55-
type: 'basic',
56-
username: USER,
57-
password: password,
58-
};
59-
6048
// Connect to github
6149
let github = new GitHubAPI();
62-
github.authenticate(auth);
50+
github.authenticate(token);
6351
github.repos.createRelease({
6452
user: USER,
6553
repo: REPO,

0 commit comments

Comments
 (0)