This repository implements a multi-branch CI/CD pipeline using GitHub Actions with automated security gates, controlled promotion, production verification, and scheduled artifact backups.
Designed for structured deployments to Cloudflare Pages, this pipeline enforces progressive hardening from dev → test → prod.
dev → test → prod
| Branch | Purpose | Security Level | Deployment |
|---|---|---|---|
dev |
Development & early validation | Moderate audit (non-blocking) | No |
test |
Pre-production validation | High audit (blocking) | Auto-merge to prod on success |
prod |
Production-ready code | High audit + final verification | Auto-deploy via Cloudflare |
| (scheduled) | Backup of prod artifacts | N/A | Artifact retention |
All workflows live under:
.github/workflows/
Triggers
- Push to
dev - Pull request targeting
dev
- Installs dependencies (
npm ci) - Checks outdated packages
- Runs a non-blocking security audit (
moderatelevel) - Builds the project
npm audit --omit=dev --audit-level=moderate
- Does NOT block merge
- Intended for early warning
- Encourages remediation before promotion
If successful:
- Build confirmation
- Suggestion to create PR to
test
Triggers
- Push to
test - Pull request targeting
test
- Strict production dependency audit
- Blocks on
highvulnerabilities - Builds the project
- Runs preview
- Auto-merges
test→prodif successful
npm audit --omit=dev --audit-level=high
This step is BLOCKING.
If vulnerabilities are found:
- Merge is prevented
prodremains untouched
Requires a Personal Access Token stored as:
secrets.PAT_TOKEN
Used for pushing to prod.
Trigger
- Push to
prod
This is the final verification stage before Cloudflare deployment.
- Final security audit
- Production build with
NODE_ENV=production - Generates deployment metadata
- Creates build artifact (7-day retention)
- Blocks deployment on failure
npm audit --omit=dev --audit-level=high
Cloudflare Pages is configured to:
Auto-deploy from the prod branch
GitHub verifies integrity before Cloudflare deploys.
Trigger
- Every Sunday at 12:00 UTC (4 AM PST standard time)
- Manual trigger via Actions tab
- Checks out
prod - Builds project
- Archives
.svelte-kit/ - Uploads artifact (30-day retention)
Artifact naming format:
backup-YYYYMMDD-HHMMSS-COMMIT_SHA.tar.gz
- Weekly production state snapshot
- Recovery mechanism
- Deployment traceability
| Stage | Audit Level | Blocking |
|---|---|---|
| dev | moderate | ❌ No |
| test | high | ✅ Yes |
| prod | high | ✅ Yes |
Only production dependencies are audited:
--omit=dev
This ensures runtime security integrity without noise from dev-only tooling.
| Workflow | Artifact | Retention |
|---|---|---|
| backup | Scheduled backup | 30 days |
| prod | Production build | 7 days |
Artifacts are available in the Actions → Workflow Run → Artifacts section.
- Node.js 20
npm cicompatible lockfile- Cloudflare Pages configured to deploy from
prod - GitHub secret:
PAT_TOKEN
- Push feature →
dev - CI validates build + warns on moderate vulnerabilities
- Merge
dev→test - Strict audit runs
- Auto-merge into
prodif clean - Production verification runs
- Cloudflare auto-deploys
- Weekly backups stored automatically
- Progressive security hardening
- Zero-trust promotion model
- Immutable production branch
- Automated recovery artifacts
- Deterministic builds via
npm ci
Production deployment metadata includes:
- Commit SHA
- Branch name
- Triggering user
- UTC timestamp
This improves auditability and rollback clarity.
| Failure Point | Effect |
|---|---|
| Dev audit fails | Warning only |
| Test audit fails | Blocks promotion |
| Prod build fails | Blocks deployment |
| Backup fails | Logged in Actions |
.github/
└── workflows/
├── dev.yml
├── test.yml
├── prod.yml
└── backup.yml
MIT License
Copyright (c) 2026 Ricardo Godinez
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.