build-web-deployment.yml 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162
  1. name: CI 构建 Web 部署版本(Nginx 代理模式)
  2. on:
  3. push:
  4. branches:
  5. - master
  6. repository_dispatch:
  7. types:
  8. - webhook_trigger_web
  9. workflow_dispatch: # 支持手动触发
  10. # 并发控制:自动取消旧的运行
  11. concurrency:
  12. group: build-web-deployment-${{ github.ref }}
  13. cancel-in-progress: true
  14. jobs:
  15. build-h5-web:
  16. runs-on: [win-h5-only]
  17. steps:
  18. - name: 检出代码
  19. uses: actions/checkout@v4
  20. - name: 设置 Node.js 环境
  21. uses: actions/setup-node@v4
  22. with:
  23. node-version: '20'
  24. - name: 智能安装依赖(跨平台)
  25. run: node .build/smart-install.js
  26. - name: 测试 SSH 连接
  27. env:
  28. DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
  29. DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
  30. DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
  31. DEPLOY_PATH: ${{ secrets.WEB_DEPLOY_PATH }}
  32. run: node .build/deploy-to-server.js --test
  33. - name: 构建 H5 (Web 部署 - Nginx 代理模式)
  34. shell: powershell
  35. env:
  36. GH_TOKEN: ${{ secrets.GH_TOKEN }}
  37. TARO_API_URL: ''
  38. TARO_MQTT_URL: '/mqtt'
  39. run: |
  40. Write-Host "🌐 Web 部署模式 (Nginx 代理)"
  41. Write-Host " 使用 h5_for_production.js 构建脚本"
  42. Write-Host " API URL: 空字符串 (nginx根据路径转发)"
  43. Write-Host " MQTT URL: /mqtt (nginx代理转发)"
  44. Write-Host ""
  45. Write-Host "当前操作系统平台: Windows"
  46. Write-Host "当前CPU架构: $env:PROCESSOR_ARCHITECTURE"
  47. node .build/h5_for_production.js
  48. - name: 部署到服务器
  49. env:
  50. DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
  51. DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
  52. DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
  53. DEPLOY_PATH: ${{ secrets.WEB_DEPLOY_PATH }}
  54. run: node .build/deploy-to-server.js