CIRCLECI PIPELINE TO DEPLOY ANGULAR APP TO FIREBASE

version: 2.1
jobs:
build:
working_directory: /tmp/workspace
docker:
- image: circleci/node:12.11.1-browsers
steps:
- checkout
- restore_cache:
key: dependencies-{{ checksum "package.json" }}
- run:
name: Install dependencies
command: npm install
- save_cache:
key: dependencies-{{ checksum "package.json" }}
paths:
- ./node_modules
- run:
name: Install Angular cli
command: sudo npm install -g @angular/cli > /dev/null
- run:
name: Build uat application
command: ng build --configuration=prod
- run:
name: Test application
command: ng test -- --watch=false
- persist_to_workspace:
root: /tmp/workspace
paths:
- dist
deploy:
working_directory: /tmp/workspace
docker:
- image: circleci/node:12.11.1-browsers
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
name: Install Firebase
command: npm install -D firebase-tools
- run:
name: Deploy to firebase prod
command: ./node_modules/.bin/firebase deploy --token=$FIREBASE_TOKEN --only hosting:prod
workflows:
build-and-deploy:
jobs:
- build:
filters:
branches:
only: master
- deploy:
requires:
- build
filters:
branches:
only: master
version: 2.1
jobs:
build:
working_directory: /tmp/workspace
docker:
- image: circleci/node:12.11.1-browsers
steps:
- checkout
- restore_cache:
key: dependencies-{{ checksum "package.json" }}
- run:
name: Install dependencies
command: npm install
- save_cache:
key: dependencies-{{ checksum "package.json" }}
paths:
- ./node_modules
    - run:
name: Install Angular cli
command: sudo npm install -g @angular/cli > /dev/null
- run:
name: Build uat application
command: ng build --configuration=prod
- run:
name: Test application
command: ng test -- --watch=false
- persist_to_workspace:
root: /tmp/workspace
paths:
- dist
deploy:
working_directory: /tmp/workspace
docker:
- image: circleci/node:12.11.1-browsers
steps:
- checkout
- attach_workspace:
at: /tmp/workspace
- run:
name: Install Firebase
command: npm install -D firebase-tools
- run:
name: Deploy to firebase prod
command: ./node_modules/.bin/firebase deploy --token=$FIREBASE_TOKEN --only hosting:prod
workflows:
build-and-deploy:
jobs:
- build:
filters:
branches:
only: master
- deploy:
requires:
- build
filters:
branches:
only: master

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store
Emanuelefricano

Emanuelefricano

Software Engineer with a boundless passion for football