Files
MokoCLI/docs/workflows/demo-deployment.md
T
2026-04-26 23:11:26 -05:00

76 lines
2.8 KiB
Markdown

<!--
Copyright (C) 2026 Moko Consulting <hello@mokoconsulting.tech>
This file is part of a Moko Consulting project.
SPDX-License-Identifier: GPL-3.0-or-later
# FILE INFORMATION
DEFGROUP: MokoStandards.Documentation
INGROUP: MokoStandards
REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-API
PATH: /docs/workflows/demo-deployment.md
VERSION: 04.06.00
BRIEF: Guide for the SFTP demo server deployment workflow
-->
[![MokoStandards](https://img.shields.io/badge/MokoStandards-04.06.00-orange)](https://git.mokoconsulting.tech/MokoConsulting/MokoStandards)
# Demo Server Deployment
Automated SFTP deployment of the `src/` directory to the demo server on merge to main.
## Overview
The `deploy-demo.yml` workflow pushes the contents of `src/` to a demo server over **SFTP** when:
- A commit is pushed to `main` or `master`
- A pull request targeting `main`/`master` is **merged**
- Triggered manually via workflow dispatch
Unlike `deploy-dev.yml`, the demo workflow deploys the **real version** (no "development" override).
## Required Variables
| Variable | Scope | Description |
|----------|-------|-------------|
| `DEMO_FTP_HOST` | org | Demo server hostname (may include `:port` suffix) |
| `DEMO_FTP_PATH` | org | Base remote path (e.g., `/var/www/demo`) |
| `DEMO_FTP_USERNAME` | org | SFTP username |
| `DEMO_FTP_SUFFIX` | repo | Repo-specific subdirectory appended to `DEMO_FTP_PATH` |
| `DEMO_FTP_PORT` | org (optional) | Explicit port override (auto-detected from host or defaults to 22) |
## Required Secrets
| Secret | Scope | Description |
|--------|-------|-------------|
| `DEMO_FTP_KEY` | org | SSH private key (preferred) |
| `DEMO_FTP_PASSWORD` | org | SFTP password or key passphrase |
At least one of `DEMO_FTP_KEY` or `DEMO_FTP_PASSWORD` must be set.
## Behaviour
1. **Permission check**`jmiller` and `gitea-actions[bot]` are always authorized; other actors need `admin` or `maintain` role
2. **Skip on chore/ branches** — PRs from `chore/` branches do not trigger deployment
3. **Skip if DEMO_FTP_SUFFIX not set** — repos without the variable are silently skipped
4. **Clear remote folder** — always clears the remote destination before uploading
5. **Upload** — deploys via `deploy-sftp.php` using phpseclib3
6. **Failure issue** — creates/updates a `deploy-failure` issue on error
## Differences from Dev Deployment
| Feature | Dev | Demo |
|---------|-----|------|
| Triggers | `dev/**`, `develop`, `development` | `main`, `master` |
| Version | Set to `"development"` | Real version from README.md |
| Variables | `DEV_FTP_*` | `DEMO_FTP_*` |
## See Also
- [Dev Deployment](dev-deployment.md)
- [SFTP Guide](../deployment/sftp.md)
- [.ftpignore Reference](../deployment/ftpignore.md)
> **Note:** `deploy-rs.yml` has been retired. RS deployment is handled via the release pipeline only.