Cloud Resume Challenge Part 3 - Building a Front-End CI/CD Pipeline for the Cloud Resume Challenge with GitHub Actions

Cloud Engineer and DevOps enthusiast, just talking about AWS, Docker, Linux, Kubernetes, Python, and automation.
Search for a command to run...

Cloud Engineer and DevOps enthusiast, just talking about AWS, Docker, Linux, Kubernetes, Python, and automation.
That was very insightful. I look forward to working on the cloud skills challenge program to boost my skills in the devOps world
Level up your AWS cloud skills with the AWS Cloud Resume Challenge Series. Build and deploy a serverless web app using AWS services, mastering cloud computing and CI/CD practices.
Welcome to the second part of our Cloud Resume Challenge series! In this instalment, we will be showcasing how to build a website visitors counter using the powerful combination of API Gateway, Lambda, and DynamoDB. This step-by-step guide will walk ...
Running your own home lab used to mean expensive hardware, complex networking, and hours of manual configuration. This project changes that. With a single Raspberry Pi, Docker Compose, and a few hundr

Welcome to an advanced hybrid directory demo where we'll guide you through setting up a hybrid environment, connecting to simulated on-premises infrastructure, creating a managed Microsoft AD within AWS, establishing a two-way forest trust, and integ...

Hello DevOps Community! Today marks the completion of the #90DaysOfDevOps Challenge, and it's a moment to reflect on the journey we've undertaken together. Throughout this period, I've engaged with various technologies, refining my skills in the DevO...

In a modern cloud infrastructure setup, creating a robust and scalable 2-tier architecture is essential. Such an architecture helps meet the demands of your applications while ensuring repeatability, reliability, and security. In this article, we'll ...

Welcome to Part 4 of my series on building a comprehensive CI/CD pipeline in AWS. In this article, I will explore AWS CodePipeline, a powerful service for building and deploying applications in a continuous integration and continuous delivery (CI/CD)...


Welcome to Part 3 of the Cloud Resume Challenge series! In this article, we will walk you through the step-by-step process of building a front-end CI/CD pipeline using GitHub Actions. By automating the deployment process, we can ensure that changes to our website are seamlessly delivered to end users. Let's dive in and explore how to leverage GitHub Actions for efficient CI/CD workflows.
Before we begin, let's briefly understand the concept of Continuous Integration (CI) and Continuous Deployment (CD) in the context of DevOps. CI involves frequently merging code changes from multiple developers into a central repository. CD automates the release and deployment of software changes to various environments, ensuring a smooth and reliable delivery pipeline. CI/CD pipelines provide benefits such as early issue detection, faster time to market, improved code quality, and increased collaboration among team members.
GitHub Actions is a powerful CI/CD platform provided by GitHub. It offers a wide range of pre-built actions and workflows that simplify the configuration and automation of CI/CD pipelines. Here's why GitHub Actions is a popular choice:
Integration with GitHub: GitHub Actions seamlessly integrates with repositories, making it easy to trigger workflows based on various events such as code pushes, pull requests, or issue updates.
Flexibility and Customization: GitHub Actions allows developers to define workflows using YAML syntax, providing flexibility and customization options tailored to project-specific requirements.
Large Ecosystem: GitHub Actions has a vast ecosystem of community-contributed actions covering a wide range of use cases. Leveraging existing solutions reduces development time and effort.
Scalability and Automation: GitHub Actions scales effortlessly to accommodate projects of any size. It supports parallel execution, enabling concurrent workflows and faster feedback loops. Its built-in automation capabilities reduce manual intervention and enhance productivity.
Secure and Reliable: GitHub Actions offers robust security features, including secrets management for secure storage and retrieval of sensitive information. Extensive logging and monitoring capabilities help track workflow execution and troubleshoot issues.
Now let's dive into the steps involved in building our front-end CI/CD pipeline using GitHub Actions:
Start by creating a YAML file, such as copy-to-s3-and-invalidate-cloudfront.yml, in the root directory of your project. Define the workflow as follows:
name: Copy website to S3 and invalidate CloudFront Distribution
on:
push:
branches:
- main
Within the workflow, define the jobs and steps required for the CI/CD pipeline:
jobs:
copy-website-to-s3-and-invalidate-cloudfront:
runs-on: ubuntu-latest
steps:
- name: checkout
uses: actions/checkout@master
- name: sync s3
uses: jakejarvis/s3-sync-action@master
with:
args: --follow-symlinks --delete --exclude '.git/*' --size-only
env:
AWS_S3_BUCKET: ${{ secrets.AWS_S3_BUCKET }}
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
AWS_REGION: 'us-east-1'
SOURCE_DIR: './ '
invalidate-cloudfront-distribution:
needs: copy-website-to-s3-and-invalidate-cloudfront
runs-on: ubuntu-latest
steps:
- name: Invalidate CloudFront
uses: chetan/invalidate-cloudfront-action@v2
env:
DISTRIBUTION: ${{ secrets.DISTRIBUTION }}
PATHS: "/*"
AWS_REGION: "us-east-1"
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }}
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
Steps In Job 1, the copy-website-to-s3-and-invalidate-cloudfront job runs on the latest version of the Ubuntu environment. It first checks out the repository code using the actions/checkout action. Next, it uses the jakejarvis/s3-sync-action action to sync the website files to an S3 bucket. The action's parameters are configured to follow symlinks, delete files not present in the source, exclude the .git directory, and compare file sizes for updates. The necessary AWS credentials, S3 bucket, AWS region, and source directory are provided through environment variables.
In Job 2, the invalidate-cloudfront-distribution job depends on the completion of the previous job. It uses the chetan/invalidate-cloudfront-action action to invalidate the CloudFront distribution. The action requires the distribution ID, paths to invalidate (in this case, all paths), and AWS credentials.
To test the workflow, follow these steps:
Commit your code changes to the main branch of your GitHub repository.
Navigate to the "Actions" tab in your GitHub repository.
You should see the workflow running based on the push event on the main branch.
Monitor the workflow execution for any errors or issues.
Once the workflow completes successfully, check your S3 bucket and CloudFront distribution to ensure that the changes have been deployed.

By following these step-by-step instructions, you have successfully built a front-end CI/CD pipeline for the Cloud Resume Challenge using GitHub Actions. GitHub Actions' integration with repositories, flexibility, large ecosystem, scalability, and automation capabilities make it an excellent choice for efficient CI/CD workflows.
Embrace the power of DevOps and leverage tools like GitHub Actions to deliver high-quality software seamlessly. In the next part of the Cloud Resume Challenge series, we will shift our focus to Infrastructure as Code (IaC) and utilize the powerful tool Terraform to create our backend infrastructure.