chore(release): add release gulp task

This commit is contained in:
Tim Lancina
2016-02-01 19:19:05 -06:00
parent f3fb182137
commit c085f6f75b
3 changed files with 59 additions and 6 deletions

View File

@ -510,10 +510,58 @@ gulp.task('prepare', function(){
}); });
gulp.task('prepublish', ['prepare'], function(done){ gulp.task('prerelease', ['prepare'], function(done){
runSequence('package', done); runSequence('package', done);
}); });
gulp.task('publish.github', function(done){
var changelog = require('conventional-changelog');
var GithubApi = require('github');
var packageJSON = require('./package.json');
var github = new GithubApi({
version: '3.0.0'
});
github.authenticate({
type: 'oauth',
token: process.env.GH_TOKEN
});
return changelog({
preset: 'angular'
})
.pipe(through2.obj(function(file, enc, cb){
github.releases.createRelease({
owner: 'driftyco',
repo: 'ionic',
tag_name: 'v' + packageJSON.version,
name: packageJSON.version,
body: file.toString()
}, done);
}));
});
gulp.task('publish.npm', function(done) {
var spawn = require('child_process').spawn;
var npmCmd = spawn('npm', ['publish', './dist']);
npmCmd.stdout.on('data', function (data) {
console.log(data.toString());
});
npmCmd.stderr.on('data', function (data) {
console.log('npm err: ' + data.toString());
});
npmCmd.on('close', function() {
done();
});
});
gulp.task('release', ['publish.npm', 'publish.github']);
require('./scripts/docs/gulp-tasks')(gulp, flags) require('./scripts/docs/gulp-tasks')(gulp, flags)
//////////////////////////////////////////////////// ////////////////////////////////////////////////////

View File

@ -5,7 +5,7 @@
"license": "Apache-2.0", "license": "Apache-2.0",
"repository": { "repository": {
"type": "git", "type": "git",
"url": "https://github.com/driftyco/ionic2.git" "url": "https://github.com/driftyco/ionic.git"
}, },
"scripts": { "scripts": {
"test": "gulp karma", "test": "gulp karma",
@ -29,11 +29,13 @@
"devDependencies": { "devDependencies": {
"canonical-path": "0.0.2", "canonical-path": "0.0.2",
"connect": "^3.3.4", "connect": "^3.3.4",
"conventional-changelog": "^0.5.3",
"cpr": "^0.4.1", "cpr": "^0.4.1",
"del": "~1.1.1", "del": "~1.1.1",
"dgeni": "^0.4.1", "dgeni": "^0.4.1",
"dgeni-packages": "^0.10.18", "dgeni-packages": "^0.10.18",
"event-stream": "^3.3.1", "event-stream": "^3.3.1",
"github": "^0.2.4",
"glob": "^5.0.14", "glob": "^5.0.14",
"gulp": "~3.8.10", "gulp": "~3.8.10",
"gulp-autoprefixer": "^2.3.0", "gulp-autoprefixer": "^2.3.0",
@ -86,4 +88,4 @@
"path": "node_modules/ionic-cz-conventional-changelog" "path": "node_modules/ionic-cz-conventional-changelog"
} }
} }
} }

View File

@ -49,7 +49,7 @@
### Releasing Ionic Source ### Releasing Ionic Source
1. Run `gulp prepublish` 1. Run `gulp prerelease`
- Pulls latest - Pulls latest
- updates package.json minor version - updates package.json minor version
- updates changelog - updates changelog
@ -57,9 +57,12 @@
2. Verify that changelog changes and package.json update are correct (`git status` && `git diff`) 2. Verify that changelog changes and package.json update are correct (`git status` && `git diff`)
3. Run [snapshot](#running-snapshot) & update if necessary 3. Run [snapshot](#running-snapshot) & update if necessary
4. Publish to npm: `npm publish ./dist`
5. Commit and push 5. Commit and push
6. Sit back and have a beer :beer: (or wine :wine_glass:) 6. Run `gulp release`
- publishes to npm
- Creates a new tag and release on Github
7. Sit back and have a beer :beer: (or wine :wine_glass:)
### Releasing Component Demos ### Releasing Component Demos
See [ionic-preview-app](https://github.com/driftyco/ionic-preview-app#updating-ionic-site) See [ionic-preview-app](https://github.com/driftyco/ionic-preview-app#updating-ionic-site)