language: node_js
node_js:
- '10'
- '12'
jobs:
  include:
    - stage: test
      script: npm test
    - stage: deploy
      script: API_KEY=$API_KEY CLIENT_ID=$CLIENT_ID GTM_ID=$GTM_ID ENABLE_GOOGLE_AUTH=true npm run build
      deploy:
        provider: s3
        access_key_id: $AWS_ACCESS_KEY_ID
        secret_access_key: $AWS_SECRET_ACCESS_KEY
        bucket: myradar-qa
        acl: public_read
        skip_cleanup: true
        local_dir: dist
        on:
          repo: thoughtworks/build-your-own-radar
          condition: "$TRAVIS_PULL_REQUEST = false"
    - stage: invalidation
      install: pip install --user awscli && export PATH=$PATH:$HOME/.local/bin
      script: 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then aws configure set preview.cloudfront true && aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"; fi'
    - stage: e2e
      if: branch = master
      script: bash ./run_e2e_tests.sh $API_KEY $TEST_CLIENT_ID $TEST_URL_LOCAL
stages:
  - name: test
    if: type = pull_request OR type = push
  - name: deploy
    if: type = push AND branch = master
  - name: invalidation
    if: type = push AND branch = master
  - name: e2e
    if: type = push AND branch = master
addons:
  apt:
    packages:
      - libgconf-2-4

language: node_js
node_js:
- '10'
- '12'
jobs:
  include:
    - stage: test
      script: npm test
    - stage: e2e
      if: branch = master
      script: bash ./run_e2e_tests.sh $API_KEY $TEST_CLIENT_ID $TEST_URL_LOCAL
    - stage: deploy
      script: CLIENT_ID=$CLIENT_ID GTM_ID=$GTM_ID npm run build
      deploy:
        provider: s3
        access_key_id: $AWS_ACCESS_KEY_ID
        secret_access_key: $AWS_SECRET_ACCESS_KEY
        bucket: myradar-qa
        acl: public_read
        skip_cleanup: true
        local_dir: dist
        on:
          repo: thoughtworks/build-your-own-radar
          condition: "$TRAVIS_PULL_REQUEST = false"
    - stage: invalidation
      install: pip install --user awscli && export PATH=$PATH:$HOME/.local/bin
      script: 'if [ "$TRAVIS_PULL_REQUEST" = "false" ]; then aws configure set preview.cloudfront true && aws cloudfront create-invalidation --distribution-id $CLOUDFRONT_DISTRIBUTION_ID --paths "/*"; fi'
stages:
  - name: test
    if: type = pull_request OR type = push
  - name: deploy
    if: type = push AND branch = master
  - name: invalidation
    if: type = push AND branch = master
  - name: e2e
    if: type = push AND branch = master
addons:
  apt:
    packages:
      - libgconf-2-4

Remove API key from build stage
[Sidharth/Devansh] Remove API key from build stage
