Skip to content

Commit

Permalink
ci: use workflows with conditional jobs
Browse files Browse the repository at this point in the history
  • Loading branch information
davidballester committed Aug 6, 2019
1 parent 18cdbd2 commit 9507a41
Showing 1 changed file with 41 additions and 22 deletions.
63 changes: 41 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,43 +1,62 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
test:
docker:
# specify the version you desire here
- image: circleci/node:10.5.0-jessie

# Specify service dependencies here if necessary
# CircleCI maintains a library of pre-built images
# documented at https://circleci.com/docs/2.0/circleci-images/
# - image: circleci/mongo:3.4.4

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: npm install

- save_cache:
paths:
- node_modules
key: v1-dependencies-{{ checksum "package.json" }}

# run tests!
- run: npm run test

# deploy to netlify
deploy:
docker:
- image: circleci/node:10.5.0-jessie
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: npm install
- run: npm run deploy

# release
release:
docker:
- image: circleci/node:10.5.0-jessie
working_directory: ~/repo
steps:
- checkout
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
- run: npm install
- run: npx semantic-release

workflows:
version: 2
test-deploy-release:
jobs:
- test
- deploy:
requires:
- test
filters:
branches:
only: master
- release:
requires:
- test
filters:
branches:
only: master

0 comments on commit 9507a41

Please sign in to comment.