-
Notifications
You must be signed in to change notification settings - Fork 0
CI CD Reference
Complete guide to Rich Statistics continuous integration and deployment.
┌─────────────────────────────────────────────────────────────────┐
│ BRANCH STRUCTURE │
├──────────────┬──────────────┬───────────────────────────────────┤
│ develop │ test │ main │
│ (dev) │ (staging) │ (production) │
├──────────────┼──────────────┼───────────────────────────────────┤
│ Auto-deploy │ Manual promote│ Manual promotion only │
│ on push │ (workflow_dispatch) │ Via promote.yml workflow │
├──────────────┼──────────────┼───────────────────────────────────┤
│ dev. │ test. │ app. │
│ richstatistics.com │ richstatistics.com │
├──────────────┼──────────────┼───────────────────────────────────┤
│ Freemius: — │ Freemius: │ Freemius: │
│ │ beta │ released (public) │
└──────────────┴──────────────┴───────────────────────────────────┘
Trigger: Push to develop or workflow_dispatch
Purpose: Continuous integration for development
Jobs:
-
build-zip— PHP checks, create ZIP (version:dev.{run_number}) -
deploy-web— Webhook deploy to dev server -
build-desktop— Tauri builds for dev
Trigger: workflow_dispatch only
Purpose: Pre-release QA with Freemius beta
Jobs:
-
build-zip— PHP checks, create ZIP -
deploy-web— Webhook deploy to test server -
upload-freemius— SDK upload withrelease_mode=beta⭐ -
build-desktop— Tauri builds for test
Trigger: Tag push (v*.*.*) or workflow_dispatch from promote.yml
Purpose: Production releases
Jobs:
-
build-zip— PHP checks, create ZIP -
upload-freemius— SDK upload (releasedorbeta) ⭐ -
release— GitHub Release, PWA snapshot -
build-desktop— Tauri builds with version stamp -
ping-deploy— Webhook deploy to production
Trigger: workflow_dispatch on develop
Purpose: Merge develop → test
Steps:
- Create PR:
develop → test - Merge PR (
--merge, not squash) - Dispatch "Build Test" workflow
Trigger: workflow_dispatch on test
Inputs: version (auto-detect), channel (stable/beta)
Steps (stable):
- Create PR:
test → main - Merge PR
-
Force-create tag:
git tag -f v{version} origin/main⭐ -
Force-push tag:
git push -f origin v{version}⭐ - Dispatch "Build Release" workflow
Why force? Handles re-releases at same version (tag already exists from previous release).
Location: bin/deploy-freemius.php
Usage:
php bin/deploy-freemius.php <file> <version> <release_mode> [sandbox]
# Examples:
php bin/deploy-freemius.php plugin.zip 2.4.20 beta
php bin/deploy-freemius.php plugin.zip 2.4.20 releasedAlgorithm:
1. GET plugins/{id}/tags.json — Check if version exists
2. IF exists: Skip upload, use existing tag ID
3. IF not exists: POST with ZIP file, get new tag ID
4. PUT release_mode to tag
Environment Variables:
DEV_ID: 25954
PUBLIC_KEY: ${FREEMIUS_PUBLIC_KEY}
SECRET_KEY: ${FREEMIUS_SECRET_KEY}
PLUGIN_SLUG: rich-statistics
PLUGIN_ID: 25954Release Modes:
| Mode | Description | Used By |
|---|---|---|
beta |
Beta opt-in users | build-test.yml, beta tags |
released |
All license holders | build-release.yml (stable) |
pending |
Unreleased (manual) | Not used in CI |
Flow:
CI workflow
↓ POST /_deploy/
Webhook PHP (validates token)
↓ Writes timestamp
.deploy-trigger file
↓ Cron poller (every minute)
rsa-app-update script
↓ Sparse-checkout docs/app/
Deploy to webroot
Manual Trigger:
curl -X POST -H "X-Deploy-Token: $(cat /etc/rsa-webhook-token-{env})" \
https://{env}.richstatistics.com/_deploy/Structure:
docs/app/v/
├── 2.4.27/
│ ├── stable/ ← Production PWA
│ │ ├── index.html, app.js, ...
│ │ └── icons/
│ └── beta/ ← Beta PWA (same files)
├── 2.4.26/
│ └── ...
├── versions.json ← Auto-generated
└── versions-beta.json ← Auto-generated (same content)
Pruning: Keep last 12 versions, remove older.
git checkout develop
# ... make changes, commit ...
git push origin develop
# Auto: build-develop.yml runsGitHub UI: Actions → Promote to Test → Run on develop
Verify:
- test.richstatistics.com updated
- Freemius shows beta version
- Desktop binaries available
- Tests pass
GitHub UI: Actions → Promote to Production → Run on test
Inputs: version=(blank), channel=stable
Verify:
- GitHub Release created
- Freemius shows "released"
- Production PWA updated
- Desktop binaries available
git fetch origin main
git tag -f v2.4.20 origin/main
git push -f origin v2.4.20
gh workflow run "Build Release" --ref "v2.4.20"Check secrets, plugin ID (25954), network connectivity.
# Check cron
grep "rsa-deploy-cron" /var/log/syslog | tail -5
# Manual trigger
curl -X POST -H "X-Deploy-Token: $(cat /etc/rsa-webhook-token)" \
https://app.richstatistics.com/_deploy/# Restore (if --delete-branch was used)
git push origin origin/main:refs/heads/develop
git push origin origin/main:refs/heads/test# Check current version
grep "RSA_VERSION" rich-statistics.php
# Trigger workflows
gh workflow run "Promote to Test" --ref develop
gh workflow run "Promote to Production" --ref test -f channel=stable
gh workflow run "Build Release" --ref "v2.4.20"
# Check Freemius
curl -u "DEV_ID:SECRET" \
"https://api.freemius.com/v1/developers/25954/plugins/25954/tags.json"
# Manual deploy
curl -X POST -H "X-Deploy-Token: $(cat /etc/rsa-webhook-token)" \
https://app.richstatistics.com/_deploy/-
Agent Instructions:
AGENTS.md -
Development Guide:
DEVELOPMENT.md
Last Updated: May 18, 2026
Current Status: ✅ All workflows operational, Freemius SDK working
- Home
- Release Tracks — Branch structure, promotion flows
- CI/CD Reference — Workflows, Freemius, deployment
- App Server Setup — Server infrastructure
- Code Map — Project structure