Skip to content

Instantly share code, notes, and snippets.

@hatemhosny
Last active October 2, 2017 01:17
Show Gist options
  • Save hatemhosny/531c61443c4083a11706eecf5aa2e9f8 to your computer and use it in GitHub Desktop.
Save hatemhosny/531c61443c4083a11706eecf5aa2e9f8 to your computer and use it in GitHub Desktop.
.circleci/config.yml
# .circleci/config.yml
#
# 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:8.2.1-browsers
# 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: ~/my-app
# branches:
# only:
# - master
# - /rc-.*/
# ignore:
# - develop
# - /feature-.*/
steps:
- checkout
# Download and cache dependencies
- restore_cache:
keys:
- v1-{{ .Branch }}-{{ checksum "package.json" }}
# fallback to using the latest cache if no exact match is found
- v1-{{ .Branch }}-
- run:
name: install-dependencies
command: npm install
- save_cache:
paths:
- node_modules
key: v1-{{ .Branch }}-{{ checksum "package.json" }}
- run:
name: angular-build
command: npm run ng -- build --prod --aot --no-progress
- run:
name: angular-test
command: npm test -- --watch=false
- store_artifacts:
path: ./test-results/test-results.xml
prefix: tests
- run:
name: angular-lint
command: npm run lint -- --formatters-dir ./tslint-formatters --format junit --out ./test-results/tslint.xml
- store_artifacts:
path: ./test-results/tslint.xml
prefix: lint
- store_test_results:
path: ./test-results
- run:
name: copy-firebase.json
command: cp firebase.json ./dist/firebase.json
- deploy:
name: Deploy Master to Firebase-staging
command: |
if [ "${CIRCLE_BRANCH}" == "master" ]; then
./node_modules/.bin/firebase deploy -P staging --token=$FIREBASE_DEPLOY_TOKEN
fi
- deploy:
name: Deploy Release to Firebase-production
command: |
if [[ "${CIRCLE_BRANCH}" == release* ]]; then
./node_modules/.bin/firebase deploy -P production --token=$FIREBASE_DEPLOY_TOKEN
fi
{
"hosting": {
"public": "dist",
"ignore": [
"firebase.json",
"**/.*",
"**/node_modules/**"
],
// Add the "rewrites" section within "hosting"
"rewrites": [ {
"source": "**",
"destination": "/index.html"
} ]
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment