This commit is contained in:
jeremygan2021
2026-03-02 12:59:46 +08:00
parent 9620a4138d
commit 0d140cd75c
6 changed files with 49 additions and 5 deletions

View File

@@ -0,0 +1,44 @@
name: Deploy to Server
on:
push:
branches:
- main
- master
jobs:
deploy:
runs-on: ubuntu
steps:
- name: Checkout
uses: actions/checkout@v3
# 建议在 Gitea 仓库设置中配置 Secrets而不是直接写在文件中
# SERVER_HOST, SERVER_USER, SERVER_PASSWORD
- name: Copy files to server
uses: appleboy/scp-action@v0.1.7
with:
host: "6.6.6.66"
username: "quant-speed"
password: "123quant-speed"
source: "."
target: "/home/quant-speed/luna2025"
# 排除不需要上传的文件
exclude: ".git,.github,.gitea,.trae,__pycache__,*.pyc,*.pyo,*.pyd,.DS_Store"
- name: Deploy on server
uses: appleboy/ssh-action@v1.0.3
with:
host: "6.6.6.66"
username: "quant-speed"
password: "123quant-speed"
script: |
# 进入项目目录
cd /home/quant-speed/luna2025
# 停止容器并删除同名镜像
# --rmi local: 删除服务构建的镜像
echo "123quant-speed" | sudo -S docker compose down --rmi local
# 启动服务
echo "123quant-speed" | sudo -S docker compose up -d