action
This commit is contained in:
44
.gitea/workflows/deploy.yaml
Normal file
44
.gitea/workflows/deploy.yaml
Normal 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
|
||||
Reference in New Issue
Block a user