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

View file

@ -15,10 +15,11 @@
"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)\"",
"lint": "./node_modules/.bin/eslint .",
"prepublish": "npm run build",
"prepublish-watch": "npm run watch",
"prepublish": "in-publish && npm run build || not-in-publish",
"start": "./node_modules/.bin/webpack-dev-server",
"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",
"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)'\""
@ -38,6 +39,7 @@
"highlightjs": "^9.8.0",
"htmlparser2": "3.9.2",
"immutable": "3.8.1",
"in-publish": "^2.0.0",
"json": "^9.0.4",
"lodash.defaultsdeep": "4.6.0",
"minilog": "3.1.0",
@ -50,7 +52,6 @@
"socket.io-client": "1.7.3",
"stats.js": "^0.17.0",
"tap": "^10.2.0",
"travis-after-all": "^1.4.4",
"webpack": "^2.4.1",
"webpack-dev-server": "^2.4.1"
}