chore: remove auto-deploy workflow (deploy is manual only)
Repo Health / Access control (push) Has been cancelled
Repo Health / Release configuration (push) Has been cancelled
Repo Health / Scripts governance (push) Has been cancelled
Repo Health / Repository health (push) Has been cancelled

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
This commit is contained in:
Jonathan Miller
2026-05-02 16:42:53 -05:00
parent 93fe181e1b
commit 1472dcb650
-201
View File
@@ -1,201 +0,0 @@
# 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: GitHub.Workflow
# INGROUP: MokoStandards.Deploy
# REPO: https://git.mokoconsulting.tech/MokoConsulting/MokoStandards-API
# PATH: /templates/workflows/joomla/deploy.yml.template
# VERSION: 01.01.00
# BRIEF: Auto-deploy src/ to dev/live servers via SSH rsync on push
#
# Required repo variables:
# DEPLOY_SSH_HOST -- SSH hostname for dev server
# DEPLOY_SSH_USER -- SSH username
# DEPLOY_SSH_PORT -- SSH port (default: 22)
# DEV_DEPLOY_PATH -- Absolute remote path for dev
# LIVE_DEPLOY_PATH -- Absolute remote path for live
#
# Optional repo variables:
# LIVE_SSH_HOST -- SSH hostname for live server (falls back to DEPLOY_SSH_HOST)
#
# Required org/repo secret:
# DEPLOY_SSH_KEY -- Private SSH key for authentication
name: Deploy
on:
push:
branches: [dev, main]
paths:
- 'src/**'
- 'htdocs/**'
workflow_dispatch:
inputs:
target:
description: 'Deploy target'
required: true
default: 'dev'
type: choice
options:
- dev
- live
dry_run:
description: 'Dry run (show what would be deployed without deploying)'
required: false
default: false
type: boolean
env:
FORCE_JAVASCRIPT_ACTIONS_TO_NODE24: true
permissions:
contents: read
jobs:
deploy:
name: Deploy to ${{ github.event_name == 'workflow_dispatch' && inputs.target || (github.ref_name == 'main' && 'Live' || 'Dev') }}
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6
- name: Determine deploy target
id: target
run: |
if [ "${{ github.event_name }}" = "workflow_dispatch" ]; then
TARGET="${{ inputs.target }}"
elif [ "${{ github.ref_name }}" = "main" ]; then
TARGET="live"
else
TARGET="dev"
fi
echo "env=${TARGET}" >> "$GITHUB_OUTPUT"
if [ "$TARGET" = "live" ]; then
echo "remote_path=${{ vars.LIVE_DEPLOY_PATH }}" >> "$GITHUB_OUTPUT"
echo "ssh_host=${{ vars.LIVE_SSH_HOST || vars.DEPLOY_SSH_HOST }}" >> "$GITHUB_OUTPUT"
else
echo "remote_path=${{ vars.DEV_DEPLOY_PATH }}" >> "$GITHUB_OUTPUT"
echo "ssh_host=${{ vars.DEPLOY_SSH_HOST }}" >> "$GITHUB_OUTPUT"
fi
# Resolve source directory
if [ -d "src" ]; then
echo "source_dir=src" >> "$GITHUB_OUTPUT"
elif [ -d "htdocs" ]; then
echo "source_dir=htdocs" >> "$GITHUB_OUTPUT"
else
echo "source_dir=" >> "$GITHUB_OUTPUT"
fi
- name: Validate configuration
run: |
ERRORS=0
if [ -z "${{ steps.target.outputs.ssh_host }}" ]; then
echo "::error::SSH host not configured (DEPLOY_SSH_HOST or LIVE_SSH_HOST)"
ERRORS=$((ERRORS + 1))
fi
if [ -z "${{ vars.DEPLOY_SSH_USER }}" ]; then
echo "::error::DEPLOY_SSH_USER variable not configured"
ERRORS=$((ERRORS + 1))
fi
if [ -z "${{ steps.target.outputs.remote_path }}" ]; then
echo "::error::${{ steps.target.outputs.env == 'live' && 'LIVE' || 'DEV' }}_DEPLOY_PATH variable not configured"
ERRORS=$((ERRORS + 1))
fi
if [ -z "${{ steps.target.outputs.source_dir }}" ]; then
echo "::error::No src/ or htdocs/ directory found -- nothing to deploy"
ERRORS=$((ERRORS + 1))
fi
if [ "$ERRORS" -gt 0 ]; then
echo "### Deploy Failed -- Missing Configuration" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "Set the required variables in **Settings > Actions > Variables**." >> "$GITHUB_STEP_SUMMARY"
exit 1
fi
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
PORT="${{ vars.DEPLOY_SSH_PORT }}"
[ -z "$PORT" ] && PORT="22"
ssh-keyscan -p "$PORT" "${{ steps.target.outputs.ssh_host }}" >> ~/.ssh/known_hosts 2>/dev/null
cat > ~/.ssh/config <<SSHEOF
Host deploy-target
HostName ${{ steps.target.outputs.ssh_host }}
User ${{ vars.DEPLOY_SSH_USER }}
Port ${PORT}
IdentityFile ~/.ssh/deploy_key
StrictHostKeyChecking accept-new
BatchMode yes
ConnectTimeout 30
SSHEOF
chmod 600 ~/.ssh/config
- name: Test SSH connection
run: ssh deploy-target "echo 'SSH connection OK'"
- name: Deploy via rsync
run: |
SOURCE="${{ steps.target.outputs.source_dir }}"
REMOTE="${{ steps.target.outputs.remote_path }}"
DRY_RUN="${{ inputs.dry_run }}"
RSYNC_ARGS=(
-rlptDvz
--checksum
--exclude='sftp-config*.json'
--exclude='*.ffs_db'
--exclude='*.sync-*'
--exclude='.DS_Store'
--exclude='Thumbs.db'
--exclude='.git/'
--exclude='.env*'
--exclude='*.ppk'
--exclude='*.pem'
--exclude='*.key'
)
[ "$DRY_RUN" = "true" ] && RSYNC_ARGS+=(--dry-run)
rsync "${RSYNC_ARGS[@]}" \
-e "ssh -F ~/.ssh/config" \
"${SOURCE}/" \
"deploy-target:${REMOTE}/"
- name: Cleanup
if: always()
run: rm -f ~/.ssh/deploy_key ~/.ssh/config
- name: Summary
if: always()
run: |
TARGET="${{ steps.target.outputs.env }}"
DRY_RUN="${{ inputs.dry_run }}"
echo "## Deploy Summary" >> "$GITHUB_STEP_SUMMARY"
echo "" >> "$GITHUB_STEP_SUMMARY"
echo "| Field | Value |" >> "$GITHUB_STEP_SUMMARY"
echo "|-------|-------|" >> "$GITHUB_STEP_SUMMARY"
echo "| Target | \`${TARGET}\` |" >> "$GITHUB_STEP_SUMMARY"
echo "| Host | \`${{ steps.target.outputs.ssh_host }}\` |" >> "$GITHUB_STEP_SUMMARY"
echo "| Remote | \`${{ steps.target.outputs.remote_path }}\` |" >> "$GITHUB_STEP_SUMMARY"
echo "| Source | \`${{ steps.target.outputs.source_dir }}/\` |" >> "$GITHUB_STEP_SUMMARY"
echo "| Trigger | \`${{ github.event_name }}\` |" >> "$GITHUB_STEP_SUMMARY"
echo "| Branch | \`${{ github.ref_name }}\` |" >> "$GITHUB_STEP_SUMMARY"
if [ "$DRY_RUN" = "true" ]; then
echo "| Mode | **Dry Run** (no files changed) |" >> "$GITHUB_STEP_SUMMARY"
fi