Portfolio Website

This portfolio website is implemented using the CI/CD pipeline described in this project. Built with Next.js 15 and React 19, the site showcases technical projects through interactive documentation, code examples, and visual diagrams. The application uses Tailwind CSS for responsive styling and leverages static site generation for optimal performance and SEO.

The portfolio demonstrates modern web development practices with client-side components, custom hooks, and modular architecture. Key features include Mermaid diagram rendering, syntax-highlighted code blocks, and responsive design across all devices. The site is hosted on AWS S3 with CloudFront CDN for global content delivery, making it the perfect candidate to showcase the automated deployment pipeline that builds, optimizes, and deploys every code change automatically through GitHub Actions.

Repository: https://github.com/samuelincoln1/portfolio

Overview

This project transforms a manual deployment process into a fully automated GitHub Actions workflow that builds, tests, and deploys to AWS S3 + CloudFront on every code push. What makes this implementation particularly interesting is that it serves both as a functional solution and a live demonstration of DevOps best practices.

The Challenge: Setting up a robust CI/CD pipeline that handles dependency management, build optimization, AWS credentials security, and automated deployments while ensuring reliable delivery and proper cache invalidation across the CloudFront distribution.

Live Result: This very page you're reading was deployed automatically through the implemented pipeline, demonstrating the system in action.

CI/CD Pipeline Architecture

The CodeFlow pipeline implements a complete automated deployment workflow that triggers on every push to the main branch. The architecture follows modern DevOps practices with clear separation of concerns and security best practices.

  • GitHub Actions: Orchestrates the entire pipeline with secure credential management and parallel job execution.
  • Node.js Build: Handles dependency installation, caching, and Next.js static export generation.
  • AWS S3: Serves as the hosting platform with optimized sync operations and automatic cleanup of old files.
  • CloudFront CDN: Provides global content delivery with intelligent cache invalidation strategies.

Pipeline Flow Diagram

Loading diagram...

Diagram generated using Mermaid.

Key Benefits

  • Zero Downtime: S3 sync ensures atomic deployments
  • Global Performance: CloudFront edge locations worldwide
  • Security First: No credentials in code, encrypted secrets
  • Cost Effective: Pay-per-use model with efficient resource utilization
  • Scalable: Handles traffic spikes automatically

Security

Security is a fundamental aspect of the CI/CD implementation, with particular attention to credential management, access control, and secure deployment practices. The pipeline ensures that sensitive information never appears in code or logs while maintaining operational transparency.

Github Secrets Management

The pipeline uses GitHub Actions secrets to securely store AWS credentials. These secrets are only available to the pipeline and are never exposed in the code or logs. The workflow leverages GitHub's encrypted secrets feature to securely store and access AWS credentials. All sensitive data is encrypted at rest and only decrypted during workflow execution, ensuring that credentials remain protected throughout the entire CI/CD process.

Required Secrets:

  • AWS_ACCESS_KEY_ID: IAM user access key with minimal required permissions
  • AWS_SECRET_ACCESS_KEY: Corresponding secret key for authentication
  • AWS_REGION: Target deployment region for resource consistency
  • S3_BUCKET_NAME: Destination bucket for static file hosting
  • CLOUDFRONT_DISTRIBUTION_ID: Distribution identifier for cache invalidation

IAM Security Model

The implementation follows the principle of least privilege by creating a dedicated IAM user specifically for CI/CD operations. This user has only the minimum permissions required for successful deployment.

S3 Permissions:

  • s3:ListBucket - Enumerate bucket contents for sync operations
  • s3:GetObject - Read existing files for comparison
  • s3:PutObject - Upload new files to the bucket
  • s3:DeleteObject - Delete files from the bucket
  • s3:PutObjectAcl - Set appropriate file permissions

CloudFront Permissions:

  • cloudfront:CreateInvalidation - Clear cached content for immediate updates.

permissions-policy.json

{
  "Version": "2012-10-17",
  "Statement": [
    {
      "Sid": "S3BucketAccess",
      "Effect": "Allow",
      "Action": [
        "s3:DeleteObject",
        "s3:GetObject",
        "s3:PutObject",
        "s3:PutObjectAcl"
      ],
      "Resource": "arn:aws:s3:::samuellincoln.com/*"
    },
    {
      "Sid": "S3BucketList",
      "Effect": "Allow",
      "Action": [
        "s3:ListBucket"
      ],
      "Resource": "arn:aws:s3:::samuellincoln.com"
    },
    {
      "Sid": "CloudFrontInvalidation",
      "Effect": "Allow",
      "Action": [
        "cloudfront:CreateInvalidation"
      ],
      "Resource": "arn:aws:cloudfront::*:distribution/E1D7FI62EWQMM"
    }
  ]
}

Github Actions Workflow

GitHub Actions provides a powerful CI/CD platform that automates the entire deployment pipeline directly within the GitHub ecosystem. This implementation leverages Actions' event-driven architecture to trigger automated deployments on every code push, ensuring rapid and consistent delivery of portfolio updates without manual intervention.

Configuration

The deployment workflow is defined in .github/workflows/deploy.yml and configured to trigger on pushes to the main branch and pull request events. This approach ensures that both production deployments and preview builds are handled automatically, providing immediate feedback on code changes.

Workflow Steps

The workflow consists of several key steps:

  • Checkout Code - Retrieves the latest repository content
  • Setup Node.js - Configures Node.js 18 environment with integrated npm caching
  • Install Dependencies - Performs clean dependency installation
  • Build Project - Generates production-optimized static export
  • Configure AWS Credentials - Securely authenticates with AWS
  • Deploy to S3 - Uploads build output to S3 with atomic deployment strategy
  • Invalidate CloudFront Cache - Clears CDN cache for immediate content updates

.github/workflows/deploy.yml

name: Deploy to AWS S3 and CloudFront

on:
  push:
    branches:
      - main
  pull_request:
    branches:
      - main

jobs:
  deploy:
    runs-on: ubuntu-latest
    
    steps:
      - name: Checkout Code
        uses: actions/checkout@v4
        
      - name: Setup Node.js
        uses: actions/setup-node@v4
        with:
          node-version: '18'
          cache: 'npm'
          
      - name: Install Dependencies
        run: npm ci
        
      - name: Build Project
        run: npm run build
        
      - name: Configure AWS Credentials
        uses: aws-actions/configure-aws-credentials@v4
        with:
          aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
          aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
          aws-region: ${{ secrets.AWS_REGION }}
          
      - name: Deploy to S3
        run: |
          aws s3 sync out/ s3://${{ secrets.S3_BUCKET_NAME }}/ --delete --cache-control max-age=31536000,public
          aws s3 cp out/index.html s3://${{ secrets.S3_BUCKET_NAME }}/index.html --cache-control max-age=0,no-cache,no-store,must-revalidate
        
      - name: Invalidate CloudFront Cache
        run: |
          aws cloudfront create-invalidation --distribution-id ${{ secrets.CLOUDFRONT_DISTRIBUTION_ID }} --paths "/*"  

Results

The result of this implementation is this very portfolio website you're currently viewing - a highly available, automatically deployed web application that demonstrates enterprise-grade DevOps practices in action. The site achieves 99.9% uptime through AWS infrastructure, global performance via CloudFront edge locations, and zero-downtime deployments through the automated CI/CD pipeline. Every code change triggers an immediate, secure deployment process that maintains strict security standards through encrypted secrets management and least-privilege IAM policies, while delivering sub-second response times worldwide. This portfolio not only showcases technical projects but serves as a living demonstration of modern cloud architecture, automated deployment strategies, and professional software development practices.