Created
June 6, 2018 07:55
-
-
Save berzniz/503a33623dfc1f6deee5534d4521024e to your computer and use it in GitHub Desktop.
Starter CircleCI v2 configuration for Node.js apps
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
version: 2.0 | |
jobs: | |
test: | |
docker: | |
- image: circleci/node:8.10 | |
working_directory: ~/circleci-build | |
environment: | |
EXAMPLE_ENV_FOR_TESTING: "test" | |
steps: | |
- checkout | |
- restore_cache: | |
key: dependency-cache-{{ checksum "package.json" }} | |
- run: yarn | |
- save_cache: | |
key: dependency-cache-{{ checksum "package.json" }} | |
paths: | |
- node_modules | |
- run: yarn test | |
- persist_to_workspace: | |
root: /home/circleci | |
paths: | |
- circleci-build | |
build: | |
docker: | |
- image: circleci/node:8.10 | |
working_directory: ~/circleci-build | |
steps: | |
- attach_workspace: | |
at: /home/circleci | |
- run: | |
command: yarn build | |
environment: | |
NODE_ENV: "production" | |
- persist_to_workspace: | |
root: /home/circleci | |
paths: | |
- circleci-build | |
deploy: | |
docker: | |
- image: circleci/node:8.10 | |
working_directory: ~/circleci-build | |
environment: | |
NODE_ENV: "production" | |
steps: | |
- attach_workspace: | |
at: /home/circleci | |
- run: yarn deploy | |
workflows: | |
version: 2 | |
test-build-deploy: | |
jobs: | |
- test | |
- build: | |
requires: | |
- test | |
- deploy: | |
requires: | |
- build | |
filters: | |
branches: | |
only: master |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment