2018-02-11 01:25:00 +00:00
|
|
|
version: 2
|
|
|
|
jobs:
|
2018-02-11 01:57:13 +00:00
|
|
|
build_deploy:
|
2018-02-11 01:25:00 +00:00
|
|
|
docker:
|
2018-02-11 02:01:58 +00:00
|
|
|
- image: circleci/node:latest
|
2018-02-11 01:25:00 +00:00
|
|
|
|
|
|
|
working_directory: ~/repo
|
|
|
|
|
|
|
|
steps:
|
|
|
|
- checkout
|
|
|
|
|
|
|
|
# Download and cache dependencies
|
|
|
|
- restore_cache:
|
|
|
|
keys:
|
|
|
|
- v1-dependencies-{{ checksum "package.json" }}
|
|
|
|
# fallback to using the latest cache if no exact match is found
|
|
|
|
- v1-dependencies-
|
|
|
|
|
|
|
|
- run: yarn install
|
|
|
|
|
|
|
|
- save_cache:
|
|
|
|
paths:
|
|
|
|
- node_modules
|
|
|
|
key: v1-dependencies-{{ checksum "package.json" }}
|
|
|
|
|
2018-02-11 14:22:37 +00:00
|
|
|
- run:
|
|
|
|
name: Run tests
|
|
|
|
command: yarn test
|
|
|
|
|
2018-02-11 18:12:23 +00:00
|
|
|
- store_artifacts:
|
|
|
|
path: coverage
|
|
|
|
|
2018-02-11 14:22:37 +00:00
|
|
|
- run:
|
|
|
|
name: Build site
|
|
|
|
command: yarn build
|
|
|
|
|
2018-02-11 18:12:23 +00:00
|
|
|
- store_artifacts:
|
|
|
|
path: build
|
|
|
|
|
2018-02-11 14:22:37 +00:00
|
|
|
- run:
|
|
|
|
name: Deploy to S3
|
|
|
|
command: |
|
2018-02-11 15:08:23 +00:00
|
|
|
sudo apt-get -y -qq install awscli
|
2018-02-11 14:22:37 +00:00
|
|
|
aws s3 sync build s3://$DEPLOY_BUCKET/ --delete
|
2018-05-25 18:54:11 +00:00
|
|
|
aws s3api copy-object --copy-source $DEPLOY_BUCKET/service-worker.js --bucket $DEPLOY_BUCKET --key service-worker.js --metadata-directive REPLACE --cache-control "max-age=0" --content-type "application/javascript"
|
2018-02-11 01:49:11 +00:00
|
|
|
|
|
|
|
workflows:
|
|
|
|
version: 2
|
2018-02-11 01:57:13 +00:00
|
|
|
preview:
|
2018-02-11 01:49:11 +00:00
|
|
|
jobs:
|
2018-02-11 01:57:52 +00:00
|
|
|
- build_deploy:
|
2018-02-11 01:57:13 +00:00
|
|
|
context: preview-context
|
2018-02-11 01:49:11 +00:00
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
ignore: /.*/
|
2018-02-11 01:57:13 +00:00
|
|
|
branches:
|
|
|
|
only: /.*/
|
|
|
|
prod:
|
2018-02-11 01:49:11 +00:00
|
|
|
jobs:
|
2018-02-11 01:57:52 +00:00
|
|
|
- build_deploy:
|
2018-02-11 01:57:13 +00:00
|
|
|
context: prod-context
|
2018-02-11 01:49:11 +00:00
|
|
|
filters:
|
|
|
|
tags:
|
|
|
|
only: /.*/
|
2018-02-11 01:57:13 +00:00
|
|
|
branches:
|
|
|
|
ignore: /.*/
|