This repository has been archived on 2026-08-09. You can view files and clone it. You cannot open issues or pull requests or push a commit.
Files
Hulumath-Web-Demo/.gitea/workflows/deploy-on-merge.yml
T
2026-08-08 17:13:35 +08:00

31 lines
1.1 KiB
YAML

name: PR合并自动部署
on:
pull_request:
branches: [main]
types: [closed]
jobs:
deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: 配置SSH环境
run: |
mkdir -p ~/.ssh
echo "${{ secrets.DEPLOY_SSH_KEY }}" > ~/.ssh/deploy_key
chmod 600 ~/.ssh/deploy_key
ssh-keyscan -H ${{ secrets.DEPLOY_HOST }} >> ~/.ssh/known_hosts
- name: 远程执行部署
run: |
ssh -i ~/.ssh/deploy_key ${{ secrets.DEPLOY_USER }}@${{ secrets.DEPLOY_HOST }} << EOF
set -e
cd ${{ secrets.DEPLOY_PATH }}
git config --global --add safe.directory ${{ secrets.DEPLOY_PATH }}
git pull origin main
# 严格匹配文件夹拼写 pyporject_evn
/www/server/pyporject_evn/versions/3.12.13/bin/pip install -r requirements.txt
chown -R www:www .
# 宝塔项目重启脚本不变
/www/server/panel/pyenv/bin/python3 /www/server/panel/plugin/python/project.py restart Hulumath-Web-Demo
EOF