I’ve been trying to build more CI/CD scripts using Gitlab to automate pipeline deployments for work. Here’s a useful one for building and deploying a React app to Amazon S3.

You’ll need to add a variable called S3_BUCKET_NAME to your repo or replace the variable with your bucket path.

   - build
   - deploy
build react-app:  
   #I'm using node:latest, but be sure to test or change to a version you know works. Sometimes node updates break the npm script. 
   image: node:latest
   stage: build  
      - master  
      # Set PATH
      - export PATH=$PATH:/usr/bin/npm    
      # Install dependencies    
      - npm install    
      # Build App    
      - CI=false npm run build  
         # Build folder      
         - build/    
      expire_in: 1 hour
deploy master:
   image: python:latest
   stage: deploy
      - master
      - pip3 install awscli
      - aws s3 sync ./build s3://$S3_BUCKET_NAME --acl public-read
How to Prevent Raspberry Pi Zero from Blanking or Sleeping How to Fix ‘Converter Failed to Save File’ with Excel 2016
View Comments
There are currently no comments.