60 lines
1.2 KiB
YAML
60 lines
1.2 KiB
YAML
version: 2
|
|
jobs:
|
|
build_deploy:
|
|
docker:
|
|
- image: circleci/node:latest
|
|
|
|
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" }}
|
|
|
|
- run:
|
|
name: Run tests
|
|
command: yarn test
|
|
|
|
- run:
|
|
name: Build site
|
|
command: yarn build
|
|
|
|
- run:
|
|
name: Deploy to S3
|
|
command: |
|
|
sudo apt-get -y -qq install awscli
|
|
aws s3 sync build s3://$DEPLOY_BUCKET/ --delete
|
|
|
|
workflows:
|
|
version: 2
|
|
preview:
|
|
jobs:
|
|
- build_deploy:
|
|
context: preview-context
|
|
filters:
|
|
tags:
|
|
ignore: /.*/
|
|
branches:
|
|
only: /.*/
|
|
prod:
|
|
jobs:
|
|
- build_deploy:
|
|
context: prod-context
|
|
filters:
|
|
tags:
|
|
only: /.*/
|
|
branches:
|
|
ignore: /.*/
|