Skip to content

Instantly share code, notes, and snippets.

@denpalrius
Created September 1, 2018 10:29
Show Gist options
  • Save denpalrius/e05be7cb886aca4441a273d0b9e9e695 to your computer and use it in GitHub Desktop.
Save denpalrius/e05be7cb886aca4441a273d0b9e9e695 to your computer and use it in GitHub Desktop.
Cirlcle CI Angular config.yml
version: 2
jobs:
# The build job
build:
working_directory: ~/project
docker:
- image: circleci/node:8.11.1-browsers
steps:
# Checkout the code from the branch into the working_directory
- checkout
# echo versions
- run:
name: echo versions
command: |
node --version
npm --version
# Log the current branch
- run:
name: Show current branch
command: echo ${CIRCLE_BRANCH}
# Restore local dependencies from cache
- restore_cache:
keys:
- v1-dependencies-{{ checksum "package.json" }}
- v1-dependencies-
# Install project dependencies
- run:
name: Install local dependencies
command: npm install
# Cache local dependencies if they don't exist
- save_cache:
key: v1-dependencies-{{ checksum "package.json" }}
paths:
- node_modules
# Lint the source code
- run:
name: Rebuild node-sass
command: npm rebuild node-sass
# Lint the source code
# - run:
# name: Linting
# command: npm run lint
# Test the source code
# - run:
# name: Testing
# command: npm run test
# Build project with different configuration based on
# the current branch
- run:
name: Building
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
npm run build-prod
else
npm run build
fi
# Cache the dist folder for the deploy job
- save_cache:
key: v1-dist-{{ .Environment.CIRCLE_BRANCH }}-{{ .Environment.CIRCLE_SHA1 }}
paths:
- dist
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment