Skip to content
Permalink
Branch: master
Find file Copy path
Fetching contributors…
Cannot retrieve contributors at this time
90 lines (76 sloc) 1.86 KB
version: 2
jobs:
build:
docker:
- image: circleci/node:8.11
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-dependencies-
- run:
name: Install dependencies
command: npm install
- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}
- run:
name: Run tests
command: npm test
deploy_branch:
docker:
- image: circleci/node:8.11
working_directory: ~/repo
steps:
- checkout
- run:
name: Install dependencies
command: npm install
- run:
name: Install Serverless CLI
command: sudo npm i -g serverless
- run:
name: Deploy Master to import-dev
command: serverless deploy
deploy_prod:
docker:
- image: circleci/node:8.11
working_directory: ~/repo
steps:
- checkout
- run:
name: Install dependencies
command: npm install
- run:
name: Install Serverless CLI and dependencies
command: sudo npm i -g serverless
- run:
name: Deploy Master to import-prod
command: serverless deploy --stage prod
workflows:
version: 2
build-and-deploy:
jobs:
- build
- deploy_prod:
requires:
- build
filters:
branches:
only: /^master$/
- deploy_branch:
requires:
- build
filters:
branches:
ignore: /^master$/
- deploy_prod:
requires:
- build
filters:
branches:
only: /^master$/
You can’t perform that action at this time.