Project Description
The project involves deploying a Portfolio app on AWS S3 using GitHub Actions. Git Hub actions allows you to perform CICD with GitHub Repository integrated.
What is GITHUB Actions?
GitHub Actions is a continuous integration and continuous delivery (CI/CD) platform that allows you to automate your build, test, and deployment pipeline. You can create workflows that build and test every pull request to your repository, or deploy merged pull requests to production.
GitHub Actions goes beyond just DevOps and lets you run workflows when other events happen in your repository. For example, you can run a workflow to automatically add the appropriate labels whenever someone creates a new issue in your repository.
GitHub provides Linux, Windows, and macOS virtual machines to run your workflows, or you can host your own self-hosted runners in your own data center or cloud infrastructure.
Project execution:
Step1:Launch an EC2 instance
Git clone:https://github.com/gsbarure/tws-portfolio.git
Step2:Create S3 Bucket
Create IAM User and access key
Attached policies:
If you still gets 403 error access denied, and make ACL public
{
"Version": "2012-10-17",
"Statement": [
{
"Sid": "PublicReadForGetBucketObjects",
"Effect": "Allow",
"Principal": "*",
"Action": "s3:GetObject",
"Resource": "arn:aws:s3:::day86/*" ##Provide your bucket name
}
]
}
Step3:Now,move to GITHUB and setup a workflow
Provide your accesskey/secretkey for integration between GITHUB actions and S3 bucket
Step4:Now create your workflowfile in github
name: my-portfolio-deployment/gajananb #Nameofthedeployment
on: ##Branch you need to push changes
push:
branches:
- main
jobs: ##Any name can be provided
build-and-deploy:
runs-on: ubuntu-latest #lastest versionofubuntu
steps:
- name: Checkout #check out the repository's code into the workflow's execution environment.
uses: actions/checkout@v1 #Script actions
- 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-1
- name: Deploy static site to S3 bucket
run: aws s3 sync . s3://day86 --delete #changebuckename
So,once you commit these files should reflect in S3 bucket as we provided below line in main.yml
run: aws s3 sync . s3://day86 --delete #changebuckename
Step5:Try changing something in index.html workflows will get autotriggered
Step6:Whatever changes/files has been made got reflected in S3 bucket
Step7Navigate to Static website hosting and here we go with our website!
Step8:Here you go with #myportfolio..!!
Jenkins vs GitHub Actions:
A more detailed comparison is provided below in the tabular format:
Conclusion:
However, it is entirely depends upon you to use Jenkins or GitHub Actions in your project. GitHub Actions are now free to use for public repositories. A pay-as-you-go system is available for private repositories.
Code availability(GitHub):https://github.com/gsbarure/tws-portfolio.git
Linkdin:https://www.linkedin.com/in/gajanan-barure-7351a4140
***Happy Learning :)***โโ
Keep learning,Keep growing๐๐
Thank you for reading!! Hope you find this helpful.
#day86#90daysofdevops#devopscommunity#