version: 2.1 jobs: # Builing the project is going to start build: machine: image: ubuntu-2004:202010-01 docker_layer_caching: true steps: - checkout - run: name: Installing AWS CLI command: | sudo apt-get update sudo apt install python3-pip sudo pip3 install awsebcli --upgrade - run: npm install && npm run build - persist_to_workspace: root: . paths: - . # Deploying the code to AWS S3 Bucket deploy: machine: image: ubuntu-2004:202010-01 docker_layer_caching: true steps: - attach_workspace: at: . - checkout - run: name: Configuring AWS command: | ls if [ $CIRCLE_BRANCH = 'main' ]; then aws s3 sync ./build s3://${AWS_S3_BUCKET} fi workflows: version: 2 execute_bulk: jobs: - build: context: CLIENT - deploy: requires: - build context: CLIENT filters: branches: only: - main