Files
cloud-mcp/.gitea/workflows/deploy.yml

43 lines
1.1 KiB
YAML
Raw Permalink Blame History

This file contains ambiguous Unicode characters
This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.
name: Deploy to Server
on:
push:
branches:
- main
- master
workflow_dispatch:
jobs:
deploy:
# 使用 self-hosted runner不指定特定标签
# 或者使用你实际注册的 Runner 标签
runs-on: self-hosted
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