0 directories, 1 files

workflows

Home / tinai / .github / workflows
name: Deploy

on:
  workflow_dispatch:
    inputs:
      ref:
        description: 'Full commit SHA (or tag/branch) to deploy'
        required: false
        default: 'main'

jobs:
  deploy:
    runs-on: ubuntu-latest
    steps:
      - name: Check out commit
        uses: actions/checkout@v4
        with:
          ref: ${{ inputs.ref }}

      - name: Install lftp
        run: sudo apt-get update && sudo apt-get install -y lftp

      - name: Deploy via FTPS
        env:
          FTP_HOST: ${{ secrets.FTP_HOST }}
          FTP_USER: ${{ secrets.FTP_USER }}
          FTP_PASSWORD: ${{ secrets.FTP_PASSWORD }}
          FTP_DIR: ${{ secrets.FTP_DIR }}
        run: |
          if [ -z "$FTP_HOST" ] || [ -z "$FTP_USER" ] || [ -z "$FTP_PASSWORD" ] || [ -z "$FTP_DIR" ]; then
            echo "Missing one of the secrets FTP_HOST, FTP_USER, FTP_PASSWORD, FTP_DIR" >&2
            exit 1
          fi
          IP=$(getent hosts "$FTP_HOST" | awk '{print $1; exit}')
          if [ -z "$IP" ]; then
            echo "DNS lookup failed for $FTP_HOST" >&2
            exit 1
          fi
          SERVER_NAME="$FTP_HOST"
          PTR=$(getent hosts "$IP" | awk '{print $2; exit}')
          if [ -n "$PTR" ] && [ "$(getent hosts "$PTR" | awk '{print $1; exit}')" = "$IP" ]; then
            SERVER_NAME="$PTR"
          fi
          echo "Deploying to $SERVER_NAME ($IP)"
          stdbuf -oL -eL lftp -u "$FTP_USER","$FTP_PASSWORD" "ftp://$SERVER_NAME:21" <<SCRIPT
          debug 3
          set ftp:ssl-force true
          set ftp:ssl-protect-data true
          set ftp:passive-mode on
          set net:timeout 30
          set net:max-retries 5
          set net:reconnect-interval-base 5
          set net:reconnect-interval-max 20
          mirror -R --delete -vvv --exclude ^\.git/ --exclude ^\.idea/ --exclude ^db/ --exclude ^php_sessions/ --exclude ^\.htaccess$ --exclude ^php\.ini$ --exclude ^resources/ --exclude ^AGENTS\.md$ --exclude ^RULES\.md$ --exclude ^TASKS\.md$ . "$FTP_DIR"
          bye
          SCRIPT
❓
deploy.yml ×
Type: Unknown, text/html
1.99 Kilobytes
Last Modified 2026-11-04 09:48:28
⬇ Download File