build-win-h5-only.yml 1.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657
  1. name: CI 自动构建win h5,并上传到服务器
  2. on:
  3. push:
  4. branches:
  5. - master
  6. repository_dispatch:
  7. types:
  8. - webhook_trigger
  9. # 并发控制:自动取消旧的运行
  10. concurrency:
  11. group: build-win-h5-only-${{ github.ref }}
  12. cancel-in-progress: true
  13. jobs:
  14. build-h5-production:
  15. runs-on: [win-h5-only]
  16. steps:
  17. - name: 检出代码
  18. uses: actions/checkout@v4
  19. - name: 设置 Node.js 环境
  20. uses: actions/setup-node@v4
  21. with:
  22. node-version: '20'
  23. - name: 智能安装依赖(跨平台)
  24. run: node .build/smart-install.js
  25. - name: 测试 SSH 连接
  26. env:
  27. DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
  28. DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
  29. DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
  30. DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
  31. run: node .build/deploy-to-server.js --test
  32. - name: 构建 H5 (生产环境)
  33. shell: powershell
  34. env:
  35. GH_TOKEN: ${{ secrets.GH_TOKEN }}
  36. TARO_API_URL: 'http://localhost:6001'
  37. TARO_MQTT_URL: 'ws://localhost:8083/mqtt'
  38. run: |
  39. Write-Host "当前操作系统平台: Windows"
  40. Write-Host "当前CPU架构: $env:PROCESSOR_ARCHITECTURE"
  41. # Windows 环境不需要 ARM 平台特殊处理
  42. node .build/h5_for_production.js
  43. - name: 部署到服务器
  44. env:
  45. DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
  46. DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
  47. DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
  48. DEPLOY_PATH: ${{ secrets.DEPLOY_PATH }}
  49. run: node .build/deploy-to-server.js