diff --git a/.gitignore b/.gitignore index feba315..64121b1 100644 --- a/.gitignore +++ b/.gitignore @@ -28,4 +28,7 @@ node_modules .lock-wscript .DS_Store + +# Generated files bundle.js +dist/ diff --git a/.travis.yml b/.travis.yml index 4371084..ba292fb 100644 --- a/.travis.yml +++ b/.travis.yml @@ -10,3 +10,14 @@ before_install: - tar -xjf phantomjs-2.0.0-ubuntu-12.04.tar.bz2 - export PATH=$PWD:$PATH script: npm run ci +# whenever a tag is pushed, we deploy to github releases +before_deploy: npm run release +deploy: + provider: releases + api_key: $GH_TOKEN + file: "dist/chromeide.zip" + skip_cleanup: true + on: + tags: true + node: '0.10' + all_branches: true diff --git a/gulpfile.babel.js b/gulpfile.babel.js index 902e5e4..936fcd1 100644 --- a/gulpfile.babel.js +++ b/gulpfile.babel.js @@ -2,13 +2,26 @@ const path = require('path'); +const del = require('del'); const gulp = require('gulp'); const chalk = require('chalk'); +const zip = require('gulp-zip'); const gutil = require('gulp-util'); const webpack = require('webpack'); const shouldWatch = (process.argv.indexOf('--watch') !== -1); +const files = { + release: [ + 'manifest.json', + 'index.html', + 'bundle.js', + 'background.js', + '_locales/**', + 'icons/**' + ] +}; + const webpackConfig = { entry: './client.js', output: { @@ -65,4 +78,20 @@ function js(cb){ }); } +function release(){ + return gulp.src(files.release, { base: __dirname }) + .pipe(zip('chromeide.zip')) + .pipe(gulp.dest('dist')); +} + +function postinstall(cb){ + // .pem files cause Chrome to show a bunch of warnings + // so we remove them on postinstall + del('node_modules/**/*.pem', cb); +} + +gulp.task(release); +gulp.task(postinstall); + +gulp.task('gh-release', gulp.series(js, release)); gulp.task('default', gulp.parallel(js)); diff --git a/package.json b/package.json index b8fd66c..7bd7ec9 100644 --- a/package.json +++ b/package.json @@ -26,9 +26,11 @@ "browser-serialport": "git://github.com/garrows/browser-serialport#update", "chalk": "^1.0.0", "css-loader": "^0.9.1", + "del": "^1.1.1", "expect": "git://github.com/phated/expect", "gulp": "git://github.com/gulpjs/gulp#4.0", "gulp-util": "^3.0.4", + "gulp-zip": "^2.0.3", "html-loader": "^0.2.3", "json-loader": "^0.5.1", "level-js": "^2.1.6", @@ -41,7 +43,9 @@ "scripts": { "test": "zuul test/*.js --local --open", "ci": "zuul test/*.js --phantom", - "build": "gulp" + "build": "gulp", + "release": "gulp gh-release", + "postinstall": "gulp postinstall" }, "repository": { "type": "git",