if: (branch = development) OR (branch = master) OR (type = pull_request) OR (tag IS present) sudo: required dist: xenial services: - docker language: node_js node_js: - "10" os: - linux env: global: - DOCKER_COMPOSE_VERSION=1.22.0 matrix: include: - env: - REACT_APP_NETWORK='mainnet' - STAGING_BUCKET_NAME=${STAGING_MAINNET_BUCKET_NAME} if: branch = master OR tag IS present - env: - REACT_APP_NETWORK='rinkeby' before_install: # Install custom docker-compose version - sudo rm /usr/local/bin/docker-compose - curl -Ls https://github.com/docker/compose/releases/download/${DOCKER_COMPOSE_VERSION}/docker-compose-`uname -s`-`uname -m` > docker-compose - chmod +x docker-compose - sudo mv docker-compose /usr/local/bin # Shut down postgres because it blocks our db container's port map to :5432 # it comes enabled by default in docker-compose - sudo service postgresql stop # Wait for it to stop - while sudo lsof -Pi :5432 -sTCP:LISTEN -t; do sleep 1; done # Needed to deploy pull request and releases - sudo apt-get -y install python-pip python-dev - pip install awscli --upgrade --user # Install truffle - yarn global add truffle before_script: # Used in the tests of the project - export NODE_ENV=testing - git clone https://github.com/gnosis/safe-transaction-history.git - cd safe-transaction-history - git checkout develop - docker-compose build - docker-compose up -d # Give some time to docker to enable all services - sleep 15 - cd .. script: - yarn build after_success: - cd safe-transaction-history - docker-compose stop - cd .. - | if [ ${TRAVIS_BRANCH} = "master" ]; then export NODE_ENV=production; else export NODE_ENV=development; fi - if [[ -n "$TRAVIS_TAG" ]]; then export REACT_APP_ENV='production'; fi - yarn build-storybook - yarn build # Pull Request - Deploy it to a review environment # Travis doesn't do deploy step with pull requests builds - ./config/travis/deploy_pull_request.sh # Releases (tagged commits) - Deploy it to a release environment - ./config/travis/deploy_release.sh deploy: # Development environment - provider: s3 bucket: $DEV_BUCKET_NAME access_key_id: $AWS_ACCESS_KEY_ID secret_access_key: $AWS_SECRET_ACCESS_KEY skip_cleanup: true local_dir: build_webpack upload-dir: app on: branch: development # Development environment - Storybook - provider: s3 bucket: $DEV_BUCKET_NAME access_key_id: $AWS_ACCESS_KEY_ID secret_access_key: $AWS_SECRET_ACCESS_KEY skip_cleanup: true local_dir: build_storybook upload-dir: storybook on: branch: development # Staging environment - provider: s3 bucket: $STAGING_BUCKET_NAME access_key_id: $AWS_ACCESS_KEY_ID secret_access_key: $AWS_SECRET_ACCESS_KEY skip_cleanup: true local_dir: build_webpack upload-dir: current on: branch: master # Prepare production deployment - provider: s3 bucket: $STAGING_BUCKET_NAME secret_access_key: $AWS_SECRET_ACCESS_KEY access_key_id: $AWS_ACCESS_KEY_ID skip_cleanup: true local_dir: build_webpack upload-dir: releases/$TRAVIS_TAG on: tags: true - provider: script script: bash config/travis/prepare_production_deployment.sh on: tags: true