@@ -12,54 +12,42 @@ const ASSETS = [
12
12
'dist/dist-min.zip' ,
13
13
] ;
14
14
15
+ const token = require ( './.token.json' ) ;
15
16
const project = require ( './package.json' ) ;
16
17
17
18
const changelogParser = require ( 'changelog-parser' ) ;
18
19
const GitHubAPI = require ( 'github' ) ;
19
20
const path = require ( 'path' ) ;
20
- const read = require ( 'read' ) ;
21
21
const semver = require ( 'semver' ) ;
22
22
23
- let password = '' ;
23
+ // Read changelog
24
+ changelogParser ( CHANGELOG , ( err , result ) => {
25
+ if ( err ) throw err ;
24
26
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 ) ;
41
34
}
35
+ createRelease ( project . version , elem . body ) ;
42
36
}
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
+ }
48
42
} )
49
43
50
44
function createRelease ( version , body ) {
51
45
console . log ( `Creating new Github release for v${ version } ` ) ;
52
46
console . log ( body ) ;
53
47
54
- let auth = {
55
- type : 'basic' ,
56
- username : USER ,
57
- password : password ,
58
- } ;
59
-
60
48
// Connect to github
61
49
let github = new GitHubAPI ( ) ;
62
- github . authenticate ( auth ) ;
50
+ github . authenticate ( token ) ;
63
51
github . repos . createRelease ( {
64
52
user : USER ,
65
53
repo : REPO ,
0 commit comments