-
Notifications
You must be signed in to change notification settings - Fork 1
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
83 additions
and
25 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,27 +1,85 @@ | ||
# 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: | ||
branches: | ||
only: | ||
- master | ||
jobs: | ||
- unit-test: | ||
requires: | ||
- checkout | ||
- deploy: | ||
requires: | ||
- unit-test |