diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..a8840dd --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,36 @@ +name: Go CI/CD Deploy to Baota + +on: + push: + branches: [ main, master ] + +jobs: + build-and-deploy: + runs-on: ubuntu-latest + steps: + - name: 拉取代码 + uses: actions/checkout@v4 + + - name: 安装 Go 环境 + uses: actions/setup-go@v5 + with: + go-version: 1.22 + + - name: 编译 Go 项目 + run: | + # 静态编译,无依赖,适合 Linux 部署 + CGO_ENABLED=0 GOOS=linux GOARCH=amd64 go build -o app main.go + + - name: 部署到宝塔项目目录并重启服务 + run: | + # 1. 停止旧进程 + pkill -f Volcano-Engine-TTS-UI || true + + # 2. 复制新程序到项目目录 + cp ./app /www/wwwroot/Volcano-Engine-TTS-UI/ + + # 3. 赋予执行权限 + chmod +x /www/wwwroot/Volcano-Engine-TTS-UI/app + + # 4. 启动新进程(后台运行) + nohup /www/wwwroot/Volcano-Engine-TTS-UI/app > /www/wwwroot/Volcano-Engine-TTS-UI/app.log 2>&1 &