Created
October 4, 2017 16:52
-
-
Save rockchalkwushock/f2946819e0d28f79028da5e2d8d1ee16 to your computer and use it in GitHub Desktop.
Full config.yml from Medium Article
This file contains hidden or 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
version: 2 | |
jobs: | |
checkout_code: | |
docker: | |
- image: circleci/node:latest | |
working_directory: ~/circleci-deployment | |
steps: | |
- checkout | |
- attach_workspace: | |
at: ~/circleci-deployment | |
- restore_cache: | |
keys: | |
- yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} | |
- yarn-cache-{{ .Branch }} | |
- yarn-cache- | |
- run: yarn install | |
- save_cache: | |
key: yarn-cache-{{ .Branch }}-{{ checksum "yarn.lock" }} | |
paths: node_modules | |
- persist_to_workspace: | |
root: . | |
paths: . | |
check_vulnerabilities: | |
docker: | |
- image: circleci/node:latest | |
working_directory: ~/circleci-deployment | |
steps: | |
- attach_workspace: | |
at: ~/circleci-deployment | |
- run: yarn install | |
- run: | | |
if [ "${CIRCLE_BRANCH}" == "production" ]; then | |
yarn validate:dependencies | |
else | |
yarn validate:dependencies || true | |
fi | |
test_and_report: | |
docker: | |
- image: circleci/node:latest | |
working_directory: ~/circleci-deployment | |
steps: | |
- attach_workspace: | |
at: ~/circleci-deployment | |
- run: yarn install | |
- run: CI=true yarn test:coverage | |
- run: yarn reportCoverage | |
- store_artifacts: | |
path: ./coverage/clover.xml | |
prefix: tests | |
- store_artifacts: | |
path: coverage | |
prefix: coverage | |
- store_test_results: | |
path: ./coverage/clover.xml | |
build: | |
docker: | |
- image: circleci/node:latest | |
working_directory: ~/circleci-deployment | |
steps: | |
- attach_workspace: | |
at: ~/circleci-deployment | |
- run: yarn install | |
- run: | |
name: yarn build | |
command: | | |
if [ "${CIRCLE_BRANCH}" == "production" ]; then | |
CI=true PUBLIC_URL=https://circleci-deployment-production.now.sh yarn build | |
elif [ "${CIRCLE_BRANCH}" == "development" ]; then | |
CI=true PUBLIC_URL=https://circleci-deployment-alpha.now.sh yarn build | |
elif [ "${CIRCLE_BRANCH}" == "master" ]; then | |
CI=true PUBLIC_URL=https://circleci-deployment-beta.now.sh yarn build | |
else | |
echo "This failed miserably!" | |
fi | |
- persist_to_workspace: | |
root: . | |
paths: . | |
deployment: | |
docker: | |
- image: circleci/node:latest | |
working_directory: ~/circleci-deployment | |
steps: | |
- attach_workspace: | |
at: ~/circleci-deployment | |
- run: yarn install | |
- run: sudo yarn global add now | |
- deploy: | |
name: Deploy & Alias. | |
command: | | |
if [ "${CIRCLE_BRANCH}" == "production" ]; then | |
now build -t ${NOW_TOKEN} -n=circleci-deployment --static | |
now -t ${NOW_TOKEN} alias circleci-deployment-production.now.sh | |
elif [ "${CIRCLE_BRANCH}" == "development" ]; then | |
now build -t ${NOW_TOKEN} -n=circleci-deployment --static | |
now -t ${NOW_TOKEN} alias circleci-deployment-alpha.now.sh | |
elif [ "${CIRCLE_BRANCH}" == "master" ]; then | |
now build -t ${NOW_TOKEN} -n=circleci-deployment --static | |
now -t ${NOW_TOKEN} alias circleci-deployment-beta.now.sh | |
else | |
echo "This failed miserably!" | |
fi | |
workflows: | |
version: 2 | |
test_build_deploy: | |
jobs: | |
- checkout_code | |
- check_vulnerabilities: | |
requires: | |
- checkout_code | |
- test_and_report: | |
requires: | |
- checkout_code | |
- build: | |
requires: | |
- checkout_code | |
filters: | |
branches: | |
only: | |
- development | |
- master | |
- production | |
- deployment: | |
requires: | |
- check_vulnerabilities | |
- test_and_report | |
- build | |
filters: | |
branches: | |
only: | |
- development | |
- master | |
- production |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment