|
| 1 | +version: 2 |
| 2 | +defaults: &defaults |
| 3 | + docker: |
| 4 | + - image: circleci/python:2.7-stretch-browsers |
| 5 | +install_dependency: &install_dependency |
| 6 | + name: Installation of build and deployment dependencies. |
| 7 | + command: | |
| 8 | + sudo apt install jq |
| 9 | + sudo pip install awscli --upgrade |
| 10 | + sudo pip install docker-compose |
| 11 | +install_deploysuite: &install_deploysuite |
| 12 | + name: Installation of install_deploysuite. |
| 13 | + command: | |
| 14 | + git clone --branch v1.4.2 https://github.com/topcoder-platform/tc-deploy-scripts ../buildscript |
| 15 | + cp ./../buildscript/master_deploy.sh . |
| 16 | + cp ./../buildscript/buildenv.sh . |
| 17 | + cp ./../buildscript/awsconfiguration.sh . |
| 18 | +restore_cache_settings_for_build: &restore_cache_settings_for_build |
| 19 | + key: docker-node-modules-{{ checksum "package-lock.json" }} |
| 20 | + |
| 21 | +save_cache_settings: &save_cache_settings |
| 22 | + key: docker-node-modules-{{ checksum "package-lock.json" }} |
| 23 | + paths: |
| 24 | + - node_modules |
| 25 | + |
| 26 | +builddeploy_steps: &builddeploy_steps |
| 27 | + - checkout |
| 28 | + - setup_remote_docker |
| 29 | + - run: *install_dependency |
| 30 | + - run: *install_deploysuite |
| 31 | + - restore_cache: *restore_cache_settings_for_build |
| 32 | + - run: ./build.sh ${APPNAME} |
| 33 | + - save_cache: *save_cache_settings |
| 34 | + - deploy: |
| 35 | + name: Running MasterScript. |
| 36 | + command: | |
| 37 | + ./awsconfiguration.sh $DEPLOY_ENV |
| 38 | + source awsenvconf |
| 39 | + ./buildenv.sh -e $DEPLOY_ENV -b ${LOGICAL_ENV}-${APPNAME}-deployvar |
| 40 | + source buildenvvar |
| 41 | + ./master_deploy.sh -d ECS -e $DEPLOY_ENV -t latest -s ${LOGICAL_ENV}-global-appvar,${LOGICAL_ENV}-${APPNAME}-appvar -i ${APPNAME} |
| 42 | +
|
| 43 | +jobs: |
| 44 | + # Build & Deploy against development backend |
| 45 | + "build-dev": |
| 46 | + <<: *defaults |
| 47 | + environment: |
| 48 | + DEPLOY_ENV: "DEV" |
| 49 | + LOGICAL_ENV: "dev" |
| 50 | + APPNAME: "micro-frontends-react-app" |
| 51 | + steps: *builddeploy_steps |
| 52 | + |
| 53 | + "build-prod": |
| 54 | + <<: *defaults |
| 55 | + environment: |
| 56 | + DEPLOY_ENV: "PROD" |
| 57 | + LOGICAL_ENV: "prod" |
| 58 | + APPNAME: "micro-frontends-react-app" |
| 59 | + steps: *builddeploy_steps |
| 60 | + |
| 61 | +workflows: |
| 62 | + version: 2 |
| 63 | + build: |
| 64 | + jobs: |
| 65 | + # Development builds are executed on "develop" branch only. |
| 66 | + - "build-dev": |
| 67 | + context: org-global |
| 68 | + filters: |
| 69 | + branches: |
| 70 | + only: |
| 71 | + - dev |
| 72 | + |
| 73 | + # Production builds are exectuted only on tagged commits to the |
| 74 | + # master branch. |
| 75 | + - "build-prod": |
| 76 | + context: org-global |
| 77 | + filters: |
| 78 | + branches: |
| 79 | + only: master |
0 commit comments