image: node:8.3.0
pipelines:
  branches:
    master:
      - step:
          script:
            - apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y &&  apt-get -y autoremove &&  apt-get clean
            - apt-get install -y python-pip python-dev build-essential
            - python --version
            - pip install --upgrade pip
            - pip install awscli
            - npm rebuild node-sass --force
            - yarn install
            - NODE_ENV=production yarn build
            - find ./dist -exec chmod +r {} \;
            - echo "Prod Environment"
            - aws s3 --region "us-east-2" sync ./dist s3://portal.bcbsinstitute.com --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
    development:
      - step:
          script:
            - apt-get update -y && apt-get upgrade -y && apt-get dist-upgrade -y &&  apt-get -y autoremove &&  apt-get clean
            - apt-get install -y python-pip python-dev build-essential
            - pip install --upgrade pip
            - pip install awscli
            - npm rebuild node-sass --force
            - yarn install
            - NODE_ENV=development yarn build
            - find ./dist -exec chmod +r {} \;
            - echo "Dev Environment"
            - aws s3 --region "us-east-2" sync ./dist s3://portal.dev.bcbsinstitute.com --grants read=uri=http://acs.amazonaws.com/groups/global/AllUsers
