Skip to content

Commit

Permalink
Add deployment job
Browse files Browse the repository at this point in the history
  • Loading branch information
jhiner committed May 8, 2018
1 parent 44b4624 commit 53a476a
Showing 1 changed file with 86 additions and 25 deletions.
111 changes: 86 additions & 25 deletions .circleci/config.yml
Original file line number Diff line number Diff line change
@@ -1,27 +1,88 @@
# Javascript Node CircleCI 2.0 configuration file
#
# Check https://circleci.com/docs/2.0/language-javascript/ for more details
#
version: 2
jobs:
build:
defaults: &defaults
docker:
# specify the version you desire here
- image: circleci/node:8.11.1

working_directory: ~/repo

steps:
- checkout

- run:
name: "Checking Versions"
command: |
node --version
npm --version
- run: npm install

# run tests!
- run: npm test
- image: circleci/node:8.11.1
working_directory: ~/tmp/circlci-now

version: 2
jobs:
checkout:
<<: *defaults
steps:
- checkout
- attach_workspace:
at: ~/tmp/circlci-now
- restore_cache:
keys:
- npm-cache-{{ .Branch }}-{{ checksum "package.json" }}
- npm-cache-{{ .Branch }}
- npm-cache-
- run:
name: "Checking Versions"
command: |
node --version
npm --version
- run:
name: NPM Install
command: npm install
- save_cache:
key: npm-cache-{{ .Branch }}-{{ checksum "package.json" }}
paths:
- node_modules
- persist_to_workspace:
root: .
paths: .
unit-test:
<<: *defaults
steps:
- attach_workspace:
at: ~/tmp/circlci-now
- run:
name: NPM Install
command: npm install
- run:
name: Unit Test
command: npm run test
deploy:
<<: *defaults
steps:
- attach_workspace:
at: ~/tmp/circlci-now
- run:
name: Install Now CLI
command: sudo npm install --global --unsafe-perm now
- deploy:
name: Deploy & Alias
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
now --token $ZEIT_TOKEN --local-config .now/now.production.json
now --token $ZEIT_TOKEN --local-config .now/now.production.json alias
elif [ "${CIRCLE_BRANCH}" == "develop" ]; then
now --token $ZEIT_TOKEN --local-config .now/now.staging.json
now --token $ZEIT_TOKEN --local-config .now/now.staging.json alias
else
./.now/now.feature.sh
now --token $ZEIT_TOKEN --local-config .now/now.feature.json
now --token $ZEIT_TOKEN --local-config .now/now.feature.json alias
fi
workflows:
version: 2
build:
jobs:
- checkout
- unit-test:
requires:
- checkout
deploy:
jobs:
- unit-test:
filters:
branches:
only: master
requires:
- checkout
- deploy:
filters:
branches:
only: master
requires:
- unit-test

0 comments on commit 53a476a

Please sign in to comment.