Day 86 - Project 7

2 min read

Cover Image for Day 86 - Project 7

Project Description

The project involves deploying a Portfolio app on AWS S3 using GitHub Actions. Git Hub actions allow you to perform CICD with GitHub Repository integrated.

Task-01

  • Get a Portfolio application from GitHub.

  • Build the GitHub Actions Workflow

  • Setup AWS CLI and AWS Login to sync the website to S3 (to be done as a part of YAML)

prerequisite

  • S3 bucket

  • IAM access and secret access key

Steps:

  1. Clone the GitHub Repo

    (https://github.com/LondheShubham153/tws-portfolio)

  2. Add workflow main.yml to your .github/workflow

     name: Portfolio Deployment
    
     on:
       push:
         branches:
         - main
    
     jobs:
       build-and-deploy:
         runs-on: ubuntu-latest
         steps:
         - name: Checkout
           uses: actions/checkout@v1
    
         - name: Configure AWS Credentials
           uses: aws-actions/configure-aws-credentials@v1
           with:
             aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
             aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
             aws-region: us-east-2
    
         - name: Deploy static site to S3 bucket
           run: aws s3 sync . s3://<your-s3-bucket-name> --delete
    
  3. Add Secrets and Variables

    Go to setting of the repo--->security and variable-->action-->new repo secrets and add access key and secret key

  4. Now, commit the changes to the GitHub repo files to active the workflow

  5. Check, that the s3 bucket files are uploaded.

  6. Now, on properties enable static file hosting.

  7. Now, copy the address paste it into the browser and see the magic.