Skip to content

Commit

Permalink
Ci deploy (#7)
Browse files Browse the repository at this point in the history
Added CI/CD
  • Loading branch information
stofolus authored Apr 26, 2018
1 parent 3695a68 commit 4c95b99
Showing 1 changed file with 47 additions and 22 deletions.
69 changes: 47 additions & 22 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,39 +1,64 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
docker:
# specify the version you desire here
- image: circleci/node:7.10

# 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
defaults: &defaults
working_directory: ~/repo
docker:
- image: circleci/node:8.9.1

jobs:
test:
<<: *defaults
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
- run:
name: Run tests
command: npm test

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

# run tests!
- run: npm test


- persist_to_workspace:
root: ~/repo
paths: .
deploy:
<<: *defaults
steps:
- attach_workspace:
at: ~/repo
- run:
name: Authenticate with registry
command: echo "//registry.npmjs.org/:_authToken=$npm_TOKEN" > ~/repo/.npmrc
- run:
name: Publish package
command: npm publish

workflows:
version: 2
test:
jobs:
- test
test-deploy:
jobs:
- test:
filters:
tags:
only: /^v.*/
branches:
only: /master/
- deploy:
requires:
- test
filters:
tags:
only: /^v.*/
branches:
only: /master/

0 comments on commit 4c95b99

Please sign in to comment.