This is the repository for my personal website, rewire.it. It's built with Next.js and Tailwind CSS, and deployed as a static site to Google Cloud Storage using a modern Infrastructure-as-Code approach with Terraform and GitHub Actions.
This project uses a sophisticated CI/CD pipeline for automated, secure, and repeatable deployments. The entire cloud infrastructure is managed declaratively using Terraform.
- Next.js & Tailwind CSS: For the frontend application.
- Google Cloud Storage (GCS): For hosting the static website.
- Terraform: For defining and managing the GCS bucket, IAM roles, and Workload Identity Federation.
- GitHub Actions: For orchestrating the CI/CD pipeline (build, test, deploy).
- Workload Identity Federation: For secure, keyless authentication between GitHub Actions and Google Cloud.
- Push to
main
: Any push to themain
branch automatically triggers theBuild and Deploy to GCS
GitHub Actions workflow. - Build: The workflow checks out the code, installs dependencies, and builds the Next.js application into a static site (
/out
directory). - Authenticate: It securely authenticates to Google Cloud using Workload Identity Federation. No long-lived service account keys are used.
- Deploy: The contents of the
/out
directory are synchronized with the GCS bucket. - Summary: A summary with a link to the live site is posted to the GitHub Actions run.
To deploy this project to a new Google Cloud project, you need to perform a one-time setup to provision the infrastructure and configure the necessary secrets in GitHub.
Prerequisites:
- A Google Cloud Platform (GCP) project.
- The
gcloud
CLI installed and authenticated (gcloud auth login
). - The Terraform CLI installed.
- The GitHub CLI (
gh
) installed and authenticated (gh auth login
).
Steps:
-
Navigate to the Terraform directory:
cd terraform
-
Initialize Terraform:
terraform init
-
Apply the Terraform configuration: This step will provision the GCS bucket, the service account, and the Workload Identity Pool and Provider in your GCP project. You will be prompted to enter your GCP
project_id
and your GitHub repository name (owner/repo
).terraform apply
-
Set the GitHub Secrets: Once the infrastructure is provisioned, run the provided script to set the required secrets in your GitHub repository. These secrets are used by the GitHub Actions workflow to authenticate with GCP and identify the GCS bucket.
./set-github-secrets.sh
After completing these steps, your infrastructure is ready, and the CI/CD pipeline is fully configured. All subsequent pushes to the main
branch will automatically deploy to your GCS bucket.
First, run the development server:
npm run dev
# or
yarn dev
# or
pnpm dev
# or
bun dev
Open http://localhost:3000 with your browser to see the result.
You can start editing the page by modifying app/page.tsx
. The page auto-updates as you edit the file.
This project uses next/font
to automatically optimize and load Geist, a new font family for Vercel.
To learn more about Next.js, take a look at the following resources:
- Next.js Documentation - learn about Next.js features and API.
- Learn Next.js - an interactive Next.js tutorial.
You can check out the Next.js GitHub repository - your feedback and contributions are welcome!