@@ -510,10 +510,58 @@ gulp.task('prepare', function(){
510
510
511
511
} ) ;
512
512
513
- gulp . task ( 'prepublish ' , [ 'prepare' ] , function ( done ) {
513
+ gulp . task ( 'prerelease ' , [ 'prepare' ] , function ( done ) {
514
514
runSequence ( 'package' , done ) ;
515
515
} ) ;
516
516
517
+ gulp . task ( 'publish.github' , function ( done ) {
518
+ var changelog = require ( 'conventional-changelog' ) ;
519
+ var GithubApi = require ( 'github' ) ;
520
+ var packageJSON = require ( './package.json' ) ;
521
+
522
+ var github = new GithubApi ( {
523
+ version : '3.0.0'
524
+ } ) ;
525
+
526
+ github . authenticate ( {
527
+ type : 'oauth' ,
528
+ token : process . env . GH_TOKEN
529
+ } ) ;
530
+
531
+ return changelog ( {
532
+ preset : 'angular'
533
+ } )
534
+ . pipe ( through2 . obj ( function ( file , enc , cb ) {
535
+ github . releases . createRelease ( {
536
+ owner : 'driftyco' ,
537
+ repo : 'ionic' ,
538
+ tag_name : 'v' + packageJSON . version ,
539
+ name : packageJSON . version ,
540
+ body : file . toString ( )
541
+ } , done ) ;
542
+ } ) ) ;
543
+ } ) ;
544
+
545
+ gulp . task ( 'publish.npm' , function ( done ) {
546
+ var spawn = require ( 'child_process' ) . spawn ;
547
+
548
+ var npmCmd = spawn ( 'npm' , [ 'publish' , './dist' ] ) ;
549
+
550
+ npmCmd . stdout . on ( 'data' , function ( data ) {
551
+ console . log ( data . toString ( ) ) ;
552
+ } ) ;
553
+
554
+ npmCmd . stderr . on ( 'data' , function ( data ) {
555
+ console . log ( 'npm err: ' + data . toString ( ) ) ;
556
+ } ) ;
557
+
558
+ npmCmd . on ( 'close' , function ( ) {
559
+ done ( ) ;
560
+ } ) ;
561
+ } ) ;
562
+
563
+ gulp . task ( 'release' , [ 'publish.npm' , 'publish.github' ] ) ;
564
+
517
565
require ( './scripts/docs/gulp-tasks' ) ( gulp , flags )
518
566
519
567
////////////////////////////////////////////////////
0 commit comments