Option 1: GitHub Actions

See zh-cn version for the complete YAML workflow configuration.

GitHub Secrets to Configure

Secret Description
SSH_PRIVATE_KEY Server SSH private key
DEPLOY_HOST Server IP or domain
DEPLOY_USER SSH username

Option 2: Git Hooks (Server-Side)

Configure a post-receive hook on the server to auto-deploy on push.

Option 3: Webhook Listener

A simple bash webhook that listens for deploy triggers and pulls latest code.

Security Tips

  1. Use a dedicated deploy user with minimal permissions
  2. Add passphrase to SSH keys
  3. Clean sensitive files (.env) after deployment
  4. Keep previous version for rollback
  5. Add deployment notifications (Slack/email)