# How to optimize my build

**URL:** <https://travis-ci.community/t/how-to-optimize-my-build/8534>\
**Category:** Travis CI Discussions & Feedback\
**Created:** [May 9, 2020, 5:33pm UTC](https://travis-ci.community/t/how-to-optimize-my-build/8534 "2020-05-09T17:33:17Z")\
**Posts on this page:** 1\
**Page:** 1

<div class="post-metadata">

**Author:** ![Liang-Hsuan](https://sea1.discourse-cdn.com/flex015/user_avatar/travis-ci.community/liang-hsuan/32/4556_2.png) [@Liang-Hsuan](https://travis-ci.community/u/Liang-Hsuan)\
**Post date:** [May 9, 2020, 5:33pm UTC](https://travis-ci.community/t/how-to-optimize-my-build/8534/1 "2020-05-09T17:33:17Z")

</div>

Hi friends, a newbie to Travis here. I have a following Angular CI config, and I have three questions:

1. is the `CODECOV_TOKEN=$CODECOV_TOKEN` here unnecessary since it is already exported from the settings?
2. I only want to run the `Deploy` stage on master branch, but the stage is still triggered on other branch, so `if: branch = master` is not working here?
3. I want to install chrome by default and now used in `Test` stage, but override it and install `gettext-base` package in the `Deploy` phase, how can I achieve this nicely?

Any other optimization tips are greatly appreciated 🙏🏻

```
dist: trusty
sudo: false

language: node_js
node_js:
  - "12"

addons:
  chrome: stable
  apt:
    update: true
    packages:
      - gettext-base

env:
  global:
    CODECOV_TOKEN=$CODECOV_TOKEN

cache:
  directories:
     - ./node_modules

install:
  - npm install

stages:
  - name: Lint & Test
  - name: Deploy to Firebase
    if: branch = master

jobs:
  include:
    - stage: Lint & Test
      script:
        - npm run lint

    - stage: Lint & Test
      script:
        - npm run test -- --no-watch --no-progress --code-coverage --browsers=ChromeHeadless
      after_script:
        - if [["$TRAVIS_TEST_RESULT" == 0]]; then ./node_modules/.bin/codecov; fi

    - stage: Deploy to Firebase
      skip_cleanup: true
      script:
        - npm run build -- --prod --output-path=dist
      before_deploy:
        - envsubst < ./dist/assets/env.template.js > ./dist/assets/env.js 
      deploy:
        provider: firebase
        token: $FIREBASE_TOKEN
        edge: true

```

An example pipeline [here](https://travis-ci.org/github/Liang-Hsuan/CampaignGenerator/builds/685065894)
