Skip to content

About

CI/CD pipeline using GitHub Actions to build and deploy a SvelteKit site to GitHub Pages via a two-repo GitOps pattern.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Latest commit

 

History

1 Commit

Folders and files

NameName
Last commit message
Last commit date
 
 
 
 
 
 

Repository files navigation

CI/CD Pipeline — SvelteKit to GitHub Pages

Automated build and deployment pipeline for a personal portfolio site, using GitHub Actions to implement a two-repo GitOps pattern: source code stays private while the compiled artifact is published to a separate public repository served via GitHub Pages.


Architecture

[Private source repo]
        |
        | push to main
        v
[GitHub Actions runner]
    1. Install deps (npm ci)
    2. Type-check & lint (npm run check)
    3. Build static site (npm run build)
        |
        | on success
        v
[Public GitHub Pages repo]  -->  sebamalieni.dev

Why two repos? Source code (components, content, config) stays private. Only the compiled build/ output is pushed to the public repo — so the live site is accessible without exposing implementation details.


Workflow breakdown

Step Tool Purpose
Checkout actions/checkout@v4 Pull source at the commit that triggered the run
Node setup actions/setup-node@v4 Pin Node 20, enable npm cache to speed up runs
Install npm ci Reproducible install from lockfile (not npm install)
Quality gate npm run check Svelte type-check — pipeline fails here before a broken build ships
Build npm run build Compile to static files via @sveltejs/adapter-static
Deploy peaceiris/actions-gh-pages@v3 Push build/ to external repo using a scoped PAT

Key decisions

npm ci over npm install — ci respects the lockfile exactly and fails on drift, making builds reproducible across runs and environments.

Quality gate before build — the type-check step runs first so a type error stops the pipeline immediately, before wasting time on a full build that would ship broken output.

Scoped Personal Access Token — the PAT stored in PERSONAL_ACCESS_TOKEN is granted write access only to the public Pages repo, not the source repo, following least-privilege.

Pinned action versions — all actions use major-version tags (@v3, @v4) so the pipeline doesn't silently break on upstream changes.


Trigger

Any push to main triggers the full pipeline. No manual steps required to publish a change to the live site.


Screenshots

Successful pipeline run — all steps passing

Pipeline run with all steps green

Run history — 14 workflow runs

GitHub Actions run list

Quality gate in action — failed run followed by a fix

Run #1 (feat: add CI/CD pipeline) failed at the type-check step. Run #2 (fix: set prerender for static content) resolved it and deployed successfully. This is the quality gate doing its job: a broken build never reaches the Pages repo.

Failed run followed by successful fix

About

CI/CD pipeline using GitHub Actions to build and deploy a SvelteKit site to GitHub Pages via a two-repo GitOps pattern.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

Packages

Contributors