fix(ci): disable provenance for Aliyun registry #907
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # ThingsPanel 后端社区版自动部署工作流 | |
| # | |
| # 功能说明: | |
| # 1. 自动编译并部署 ThingsPanel 后端社区版到指定服务器 | |
| # 2. 保留上传的文件目录,其他目录重新部署 | |
| # | |
| # 触发方式: | |
| # - 代码推送: 当 main 分支有代码推送时自动触发部署 | |
| # - 手动触发: 可以通过 GitHub Actions 页面手动触发 | |
| # | |
| # 部署步骤: | |
| # 1. 检出代码 | |
| # 2. 设置 Go 环境 (v1.22) | |
| # 3. 打包源码 | |
| # 4. 上传到部署服务器 | |
| # 5. 部署和重启服务 | |
| # | |
| # 服务器部署过程: | |
| # 1. 清理旧文件(保留 files 目录) | |
| # 2. 解压新代码 | |
| # 3. 编译项目 | |
| # 4. 使用 PM2 重启服务 | |
| # | |
| # 必需的 Secrets: | |
| # - C_HOST: 部署服务器地址 | |
| # - C_USER: 服务器用户名 | |
| # - C_PASS: 服务器密码 | |
| # | |
| # 注意事项: | |
| # 1. 部署时会保留 files 目录,不会被清理 | |
| # 2. 需要服务器已安装 Go 环境 | |
| # 3. 需要服务器已安装 PM2 | |
| # 4. 请确保服务器路径 /home/thingspanel/thingspanel-backend-community 存在 | |
| name: deploy | |
| # 触发构建时机 | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| # 任务 | |
| jobs: | |
| build: | |
| # Github Action CI/CD的机器选择。 | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v3 | |
| - name: Set up Go | |
| uses: actions/setup-go@v4 | |
| with: | |
| go-version: '1.22' | |
| - name: tar | |
| run: tar -zcvf thingspanel-backend-community.tar.gz ./* | |
| - name: Transfer packets server | |
| uses: appleboy/scp-action@master | |
| with: | |
| # Github Action 的服务器文件路径 | |
| host: ${{ secrets.C_HOST }} | |
| username: ${{ secrets.C_USER }} | |
| password: ${{ secrets.C_PASS }} | |
| source: "thingspanel-backend-community.tar.gz" | |
| target: "/home/thingspanel/" | |
| # 部署运行 | |
| - name: Deploy | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.C_HOST }} | |
| username: ${{ secrets.C_USER }} | |
| password: ${{ secrets.C_PASS }} | |
| port: 22 | |
| script: | | |
| source ~/.bash_profile | |
| find /home/thingspanel/thingspanel-backend-community -mindepth 1 ! -path '/home/thingspanel/thingspanel-backend-community/files*' -exec rm -rf {} + | |
| tar -zxvf /home/thingspanel/thingspanel-backend-community.tar.gz -C /home/thingspanel/thingspanel-backend-community | |
| cd /home/thingspanel/thingspanel-backend-community/ && go build -o thingspanel-backend-community | |
| /root/.local/share/pnpm/pm2 stop thingspanel-backend-community | |
| /root/.local/share/pnpm/pm2 start thingspanel-backend-community |