diff --git a/.gitea/workflows/deploy.yml b/.gitea/workflows/deploy.yml new file mode 100644 index 0000000..5a7dd67 --- /dev/null +++ b/.gitea/workflows/deploy.yml @@ -0,0 +1,51 @@ +name: build-and-deploy +on: + push: + branches: + - main + +jobs: + build-and-deploy: + runs-on: arm + container: + image: catthehacker/ubuntu:act-latest + steps: + - name: 获取代码 + uses: actions/checkout@v4 + + - name: 安装 Go + uses: actions/setup-go@v5 + with: + go-version: '1.22' + + - name: 构建后端服务 (Server) + run: | + cd server + go build -o server_bin ./cmd/server + + - name: 安装 Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + + - name: 构建浏览器扩展 (Extension) + run: | + cd extension + npm install + npm run build + + - name: 部署到测试服务器 + uses: up9cloud/action-rsync@master + env: + USER: root + HOST: 144.24.60.0 + KEY: ${{secrets.USAARMLOGIN_SSH_KEY}} + # 根据你的实际需要,调整要排除的文件及目录。 + # 这里排除了 .git,以及前端的 node_modules 和 src 等源码。 + ARGS: -avz --delete --exclude='.git/' --exclude='extension/node_modules/' --exclude='extension/src/' + SSH_ARGS: "-p 22 -o UserKnownHostsFile=/dev/null -o StrictHostKeyChecking=no" + # 如果你要部署整个项目根目录,使用 ./ + SOURCE: ./ + # 请将 TARGET 替换为你在此项目的实际部署路径 + TARGET: /var/admin/InsightReply/ + VERBOSE: true