feat: Add Gitea Actions workflows and setup documentation for deployment

This commit is contained in:
ethan.chen
2026-01-07 14:06:12 +08:00
parent 6ab690fa40
commit 459f99e804
5 changed files with 361 additions and 0 deletions

View File

@@ -0,0 +1,41 @@
name: Deploy to Server
on:
push:
branches:
- main
- master
workflow_dispatch:
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup SSH
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SERVER_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -H ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts 2>/dev/null || true
- name: Deploy to server
run: |
ssh -i ~/.ssh/deploy_key \
-o StrictHostKeyChecking=no \
-o UserKnownHostsFile=~/.ssh/known_hosts \
${{ secrets.SERVER_USERNAME }}@${{ secrets.SERVER_HOST }} << 'ENDSSH'
set -e
cd /opt/cloud-mcp || cd /path/to/cloud-mcp
git pull origin main || git pull origin master
./deploy-gitea.sh
ENDSSH
- name: Cleanup
if: always()
run: |
rm -f ~/.ssh/deploy_key