Skip to content

Commit

Permalink
chore(travis): CD add multiple deployment targets (mock/staging) (#21)
Browse files Browse the repository at this point in the history
  • Loading branch information
topheman committed May 20, 2018
1 parent 90fa2a8 commit 158a2bb
Show file tree
Hide file tree
Showing 2 changed files with 44 additions and 10 deletions.
42 changes: 33 additions & 9 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,36 @@ sudo: false
language: node_js
node_js:
- "8"
install: npm install
script:
- npm run lint
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run test:travis || npm run test:travis:pr'
deploy:
provider: surge
project: ./build/
domain: staging-npm-registry-browser.surge.sh
skip_cleanup: true
jobs:
include:
- stage: Testing / Deploy (staging/production)
install: npm install
script:
- npm run lint
- '[ "${TRAVIS_PULL_REQUEST}" = "false" ] && npm run test:travis || npm run test:travis:pr' # don't record with cypress (don't have access to API key on PRs)
deploy: # Deploy to staging on each commit to master
provider: surge
project: ./build/
domain: staging-npm-registry-browser.surge.sh
skip_cleanup: true
on:
branch: master
after_deploy:
- curl https://staging-npm-registry-browser.surge.sh
- stage: Mocked version deployment
if: branch = master AND tag IS present # skip this stage if not a tag on branch master
install: npm install
script: skip # don't re-run the tests
before_deploy:
- echo "Building Mock version - see https://github.com/topheman/npm-registry-browser#make-a-build-with-mocks"
- npm run build:mock
deploy: # Deploy mock version server on each tag on master
provider: surge
project: ./build/
domain: mock-npm-registry-browser.surge.sh
skip_cleanup: true
on:
tags: true
branch: master
after_deploy:
- curl https://mock-npm-registry-browser.surge.sh
12 changes: 11 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -196,7 +196,17 @@ The end to end test sessions are recorded, you can check them [here](https://das

## Continuous deployment (CD)

On each commit (or PR) pushed to `master`, if the tests are passing, the website will be automatically deployed from travis to a staging server: https://staging-npm-registry-browser.surge.sh/
### Staging

On each commit (or PR) pushed to `master`, if the tests are passing, a version of the website will be automatically deployed from travis to a staging server: https://staging-npm-registry-browser.surge.sh/ (that way, your QA team will be able to test your latest stable features before you release them)

### Production

On each tag pushed to `master`:

* a mocked version will be automatically deployed to this server: https://mock-npm-registry-browser.surge.sh/ ([read more about mocks](#mock-mode))

📔 Resources:

* [How to setup deployments with Travis CI](https://docs.travis-ci.com/user/deployment/surge/)

Expand Down

0 comments on commit 158a2bb

Please sign in to comment.