games_app/.gitea/workflows/deploy.yml
Your Name 5ce6a6811a
Some checks failed
CI / test-and-build (push) Failing after 25s
Add Gitea CI/CD stack, tloto-deploy, and tagged Compose images
Co-authored-by: Cursor <cursoragent@cursor.com>
2026-11-17 19:56:39 +02:00

49 lines
1.6 KiB
YAML

# Manual production deploy — same host mechanism as SSH (`tloto-deploy`).
name: Deploy
on:
workflow_dispatch:
inputs:
ref:
description: "Git SHA, tag, or branch to deploy"
required: true
type: string
mode:
description: "http or https"
required: true
default: http
type: choice
options:
- http
- https
allow_destructive_migrate:
description: "Allow destructive schema heuristic"
required: false
default: false
type: boolean
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy on host via SSH (restricted key)
env:
DEPLOY_SSH_KEY: ${{ secrets.DEPLOY_SSH_KEY }}
DEPLOY_SSH_HOST: ${{ secrets.DEPLOY_SSH_HOST }}
run: |
set -euo pipefail
if [ -z "${DEPLOY_SSH_KEY:-}" ]; then
echo "Missing secret DEPLOY_SSH_KEY. Add the private key from ~/gitea-deploy-ssh/id_ed25519 on the VPS."
exit 1
fi
HOST="${DEPLOY_SSH_HOST:-172.16.0.1}"
mkdir -p ~/.ssh
printf '%s\n' "$DEPLOY_SSH_KEY" > ~/.ssh/id_ed25519
chmod 600 ~/.ssh/id_ed25519
EXTRA=""
if [ "${{ inputs.allow_destructive_migrate }}" = "true" ]; then
EXTRA="--allow-destructive-migrate"
fi
ssh -o BatchMode=yes -o StrictHostKeyChecking=accept-new \
-i ~/.ssh/id_ed25519 "deploy@${HOST}" \
"/opt/tloto/bin/tloto-deploy --ref '${{ inputs.ref }}' --mode '${{ inputs.mode }}' ${EXTRA}"