Skip to content
This repository has been archived by the owner on Feb 27, 2019. It is now read-only.

Commit

Permalink
deploy bin with node
Browse files Browse the repository at this point in the history
  • Loading branch information
Swiip committed Jul 19, 2016
1 parent b819716 commit 6e372dc
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 2 deletions.
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -74,5 +74,4 @@ before_cache:
- npm run unlinkAll

after_success:
- echo $TRAVIS_TAG
- if [ ! -z "$TRAVIS_TAG" ] && [[ ${TRAVIS_JOB_NUMBER} == *".1" ]]; then node ./scripts/dist; node ./scripts/upload; fi
- node ./scripts/bin/deploy
1 change: 1 addition & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
"eslint-plugin-babel": "^3.1.0",
"eslint-plugin-react": "^4.3.0",
"fixture-stdout": "^0.2.1",
"form-data": "^1.0.0-rc4",
"globby": "^4.0.0",
"lodash": "^4.6.1",
"mkdirp-promise": "^2.0.0",
Expand Down
22 changes: 22 additions & 0 deletions scripts/bin/deploy.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
const co = require('co');
const path = require('path');

const exec = require('../exec');

const cwd = path.join(__dirname, '../..');

try {
co(function *() {
if (process.env.TRAVIS_TAG && /.*\.1/.test(process.env.TRAVIS_JOB_NUMBER)) {
console.log('Deploy on GitHub only on tags and first build');
return;
}

console.log('Deploying to GitHub for', process.env.TRAVIS_JOB_NUMBER, 'tag', process.env.TRAVIS_TAG);

yield exec('node', ['scripts/dist'], {cwd}).promise;
yield exec('node', ['scripts/upload'], {cwd}).promise;
});
} catch (error) {
console.log('Something went wrong', error);
}

0 comments on commit 6e372dc

Please sign in to comment.