Merge pull request #567 from rschamp/travis/stages

Use stages rather than travis-after-all to deploy
This commit is contained in:
Ray Schamp 2017-07-18 16:51:03 -04:00 committed by GitHub
commit 7ce3092875
2 changed files with 31 additions and 27 deletions

View file

@ -2,6 +2,9 @@ language: node_js
node_js: node_js:
- 6 - 6
- node - node
env:
- NPM_SCRIPT="tap:unit -- --jobs=4"
- NPM_SCRIPT="tap:integration -- --jobs=4"
sudo: false sudo: false
cache: cache:
directories: directories:
@ -9,27 +12,27 @@ cache:
install: install:
- npm install - npm install
- npm update - npm update
after_script: script: npm run $NPM_SCRIPT
- | jobs:
# RELEASE_BRANCHES and NPM_TOKEN defined in Travis settings panel include:
declare exitCode - env: NPM_SCRIPT=lint
$(npm bin)/travis-after-all node_js: 6
exitCode=$? - stage: release
if [[ node_js: 6
# Execute after all jobs finish successfully script: true
$exitCode = 0 && before_deploy: npm --no-git-tag-version version $($(npm bin)/json -f package.json version)-prerelease.$(date +%s)
# Only release on release branches deploy:
$RELEASE_BRANCHES =~ $TRAVIS_BRANCH && - provider: script
# Don't release on PR builds on:
$TRAVIS_PULL_REQUEST = "false" all_branches: true
]]; then condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH
# Authenticate NPM skip_cleanup: true
echo "//registry.npmjs.org/:_authToken=\${NPM_TOKEN}" > .npmrc script:
# Set version to timestamp - git config --global user.email $(git log --pretty=format:"%ae" -n1)
npm --no-git-tag-version version $($(npm bin)/json -f package.json version)-prerelease.$(date +%s) - git config --global user.name $(git log --pretty=format:"%an" -n1)
npm publish - npm run --silent deploy -- -x -r $GH_PAGES_REPO
# Publish to gh-pages as most recent committer - provider: npm
git config --global user.email $(git log --pretty=format:"%ae" -n1) on:
git config --global user.name $(git log --pretty=format:"%an" -n1) all_branches: true
npm run --silent deploy -- -x -r $GH_PAGES_REPO condition: $RELEASE_BRANCHES =~ $TRAVIS_BRANCH
fi api_key: $NPM_TOKEN

View file

@ -15,10 +15,11 @@
"coverage": "./node_modules/.bin/tap ./test/{unit,integration}/*.js --coverage --coverage-report=lcov", "coverage": "./node_modules/.bin/tap ./test/{unit,integration}/*.js --coverage --coverage-report=lcov",
"deploy": "touch playground/.nojekyll && ./node_modules/.bin/gh-pages -t -d playground -m \"Build for $(git log --pretty=format:%H -n1)\"", "deploy": "touch playground/.nojekyll && ./node_modules/.bin/gh-pages -t -d playground -m \"Build for $(git log --pretty=format:%H -n1)\"",
"lint": "./node_modules/.bin/eslint .", "lint": "./node_modules/.bin/eslint .",
"prepublish": "npm run build", "prepublish": "in-publish && npm run build || not-in-publish",
"prepublish-watch": "npm run watch",
"start": "./node_modules/.bin/webpack-dev-server", "start": "./node_modules/.bin/webpack-dev-server",
"tap": "./node_modules/.bin/tap ./test/{unit,integration}/*.js", "tap": "./node_modules/.bin/tap ./test/{unit,integration}/*.js",
"tap:unit": "./node_modules/.bin/tap ./test/unit/*.js",
"tap:integration": "./node_modules/.bin/tap ./test/integration/*.js",
"test": "npm run lint && npm run tap", "test": "npm run lint && npm run tap",
"watch": "./node_modules/.bin/webpack --progress --colors --watch", "watch": "./node_modules/.bin/webpack --progress --colors --watch",
"version": "./node_modules/.bin/json -f package.json -I -e \"this.repository.sha = '$(git log -n1 --pretty=format:%H)'\"" "version": "./node_modules/.bin/json -f package.json -I -e \"this.repository.sha = '$(git log -n1 --pretty=format:%H)'\""
@ -38,6 +39,7 @@
"highlightjs": "^9.8.0", "highlightjs": "^9.8.0",
"htmlparser2": "3.9.2", "htmlparser2": "3.9.2",
"immutable": "3.8.1", "immutable": "3.8.1",
"in-publish": "^2.0.0",
"json": "^9.0.4", "json": "^9.0.4",
"lodash.defaultsdeep": "4.6.0", "lodash.defaultsdeep": "4.6.0",
"minilog": "3.1.0", "minilog": "3.1.0",
@ -50,7 +52,6 @@
"socket.io-client": "1.7.3", "socket.io-client": "1.7.3",
"stats.js": "^0.17.0", "stats.js": "^0.17.0",
"tap": "^10.2.0", "tap": "^10.2.0",
"travis-after-all": "^1.4.4",
"webpack": "^2.4.1", "webpack": "^2.4.1",
"webpack-dev-server": "^2.4.1" "webpack-dev-server": "^2.4.1"
} }