Skip to content

Instantly share code, notes, and snippets.

@berzniz
Created June 6, 2018 07:55
Show Gist options
  • Save berzniz/503a33623dfc1f6deee5534d4521024e to your computer and use it in GitHub Desktop.
Save berzniz/503a33623dfc1f6deee5534d4521024e to your computer and use it in GitHub Desktop.
Starter CircleCI v2 configuration for Node.js apps
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