regexper-static/.circleci/config.yml

67 lines
1.5 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
- store_artifacts:
path: coverage
- run:
name: Build site
command: yarn build
- store_artifacts:
path: build
- run:
name: Deploy to S3
command: |
sudo apt-get -y -qq install awscli
aws s3 sync build s3://$DEPLOY_BUCKET/ --delete
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"
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: /.*/