diff --git a/gulpfile.js b/gulpfile.js index a7e31d42c3..7e7e01e29b 100644 --- a/gulpfile.js +++ b/gulpfile.js @@ -510,10 +510,58 @@ gulp.task('prepare', function(){ }); -gulp.task('prepublish', ['prepare'], function(done){ +gulp.task('prerelease', ['prepare'], function(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) //////////////////////////////////////////////////// diff --git a/package.json b/package.json index bd28b37213..256bc3da88 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "license": "Apache-2.0", "repository": { "type": "git", - "url": "https://github.com/driftyco/ionic2.git" + "url": "https://github.com/driftyco/ionic.git" }, "scripts": { "test": "gulp karma", @@ -29,11 +29,13 @@ "devDependencies": { "canonical-path": "0.0.2", "connect": "^3.3.4", + "conventional-changelog": "^0.5.3", "cpr": "^0.4.1", "del": "~1.1.1", "dgeni": "^0.4.1", "dgeni-packages": "^0.10.18", "event-stream": "^3.3.1", + "github": "^0.2.4", "glob": "^5.0.14", "gulp": "~3.8.10", "gulp-autoprefixer": "^2.3.0", @@ -86,4 +88,4 @@ "path": "node_modules/ionic-cz-conventional-changelog" } } -} +} \ No newline at end of file diff --git a/scripts/README.md b/scripts/README.md index d6d65a7c6e..08ce3d827e 100644 --- a/scripts/README.md +++ b/scripts/README.md @@ -49,7 +49,7 @@ ### Releasing Ionic Source -1. Run `gulp prepublish` +1. Run `gulp prerelease` - Pulls latest - updates package.json minor version - updates changelog @@ -57,9 +57,12 @@ 2. Verify that changelog changes and package.json update are correct (`git status` && `git diff`) 3. Run [snapshot](#running-snapshot) & update if necessary -4. Publish to npm: `npm publish ./dist` 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 See [ionic-preview-app](https://github.com/driftyco/ionic-preview-app#updating-ionic-site)