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
- Use a dedicated deploy user with minimal permissions
- Add passphrase to SSH keys
- Clean sensitive files (.env) after deployment
- Keep previous version for rollback
- Add deployment notifications (Slack/email)