Skip to content

Commit c085f6f

Browse files
committed
chore(release): add release gulp task
1 parent f3fb182 commit c085f6f

File tree

3 files changed

+59
-6
lines changed

3 files changed

+59
-6
lines changed

gulpfile.js

Lines changed: 49 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -510,10 +510,58 @@ gulp.task('prepare', function(){
510510

511511
});
512512

513-
gulp.task('prepublish', ['prepare'], function(done){
513+
gulp.task('prerelease', ['prepare'], function(done){
514514
runSequence('package', done);
515515
});
516516

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+
517565
require('./scripts/docs/gulp-tasks')(gulp, flags)
518566

519567
////////////////////////////////////////////////////

package.json

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "Apache-2.0",
66
"repository": {
77
"type": "git",
8-
"url": "https://github.com/driftyco/ionic2.git"
8+
"url": "https://github.com/driftyco/ionic.git"
99
},
1010
"scripts": {
1111
"test": "gulp karma",
@@ -29,11 +29,13 @@
2929
"devDependencies": {
3030
"canonical-path": "0.0.2",
3131
"connect": "^3.3.4",
32+
"conventional-changelog": "^0.5.3",
3233
"cpr": "^0.4.1",
3334
"del": "~1.1.1",
3435
"dgeni": "^0.4.1",
3536
"dgeni-packages": "^0.10.18",
3637
"event-stream": "^3.3.1",
38+
"github": "^0.2.4",
3739
"glob": "^5.0.14",
3840
"gulp": "~3.8.10",
3941
"gulp-autoprefixer": "^2.3.0",
@@ -86,4 +88,4 @@
8688
"path": "node_modules/ionic-cz-conventional-changelog"
8789
}
8890
}
89-
}
91+
}

scripts/README.md

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,17 +49,20 @@
4949

5050
### Releasing Ionic Source
5151

52-
1. Run `gulp prepublish`
52+
1. Run `gulp prerelease`
5353
- Pulls latest
5454
- updates package.json minor version
5555
- updates changelog
5656
- builds npm package files into dist
5757

5858
2. Verify that changelog changes and package.json update are correct (`git status` && `git diff`)
5959
3. Run [snapshot](#running-snapshot) & update if necessary
60-
4. Publish to npm: `npm publish ./dist`
6160
5. Commit and push
62-
6. Sit back and have a beer :beer: (or wine :wine_glass:)
61+
6. Run `gulp release`
62+
- publishes to npm
63+
- Creates a new tag and release on Github
64+
65+
7. Sit back and have a beer :beer: (or wine :wine_glass:)
6366

6467
### Releasing Component Demos
6568
See [ionic-preview-app](https://github.com/driftyco/ionic-preview-app#updating-ionic-site)

0 commit comments

Comments
 (0)