@@ -17,36 +17,44 @@ const project = require('./package.json');
1717const changelogParser = require ( 'changelog-parser' ) ;
1818const GitHubAPI = require ( 'github' ) ;
1919const path = require ( 'path' ) ;
20+ const read = require ( 'read' ) ;
2021const 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
4350function 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