File tree Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Expand file tree Collapse file tree 1 file changed +35
-0
lines changed Original file line number Diff line number Diff line change
1
+ "use strict"
2
+
3
+ let version = process . argv [ 2 ]
4
+ let auth = process . argv [ 3 ]
5
+
6
+ if ( ! auth ) {
7
+ console . log ( "Usage: upload-release.js [TAG] [github-user:password]" )
8
+ process . exit ( 1 )
9
+ }
10
+
11
+ require ( 'child_process' ) . exec ( "git --no-pager show -s --format='%s' " + version , ( error , stdout ) => {
12
+ if ( error ) throw error
13
+ let message = stdout . split ( "\n" ) . slice ( 2 )
14
+ message = message . slice ( 0 , message . indexOf ( "-----BEGIN PGP SIGNATURE-----" ) ) . join ( "\n" )
15
+
16
+ let req = require ( "https" ) . request ( {
17
+ host : "api.github.com" ,
18
+ auth : auth ,
19
+ headers : { "user-agent" : "Release uploader" } ,
20
+ path : "/repos/codemirror/codemirror/releases" ,
21
+ method : "POST"
22
+ } , res => {
23
+ if ( res . statusCode >= 300 ) {
24
+ console . error ( res . statusMessage )
25
+ res . on ( "data" , d => console . log ( d . toString ( ) ) )
26
+ res . on ( "end" , process . exit ( 1 ) )
27
+ }
28
+ } )
29
+ req . write ( JSON . stringify ( {
30
+ tag_name : version ,
31
+ name : version ,
32
+ body : message
33
+ } ) )
34
+ req . end ( )
35
+ } )
You can’t perform that action at this time.
0 commit comments