Day 86 - Project 7
2 min read
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:
Clone the GitHub Repo
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
Add Secrets and Variables
Go to setting of the repo--->security and variable-->action-->new repo secrets and add access key and secret key
Now, commit the changes to the GitHub repo files to active the workflow
Check, that the s3 bucket files are uploaded.
Now, on properties enable static file hosting.
Now, copy the address paste it into the browser and see the magic.