| 1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162 |
- name: CI 构建 Web 部署版本(Nginx 代理模式)
- on:
- push:
- branches:
- - master
- repository_dispatch:
- types:
- - webhook_trigger_web
- workflow_dispatch: # 支持手动触发
- # 并发控制:自动取消旧的运行
- concurrency:
- group: build-web-deployment-${{ github.ref }}
- cancel-in-progress: true
- jobs:
- build-h5-web:
- runs-on: [win-h5-only]
- steps:
- - name: 检出代码
- uses: actions/checkout@v4
- - name: 设置 Node.js 环境
- uses: actions/setup-node@v4
- with:
- node-version: '20'
- - name: 智能安装依赖(跨平台)
- run: node .build/smart-install.js
- - name: 测试 SSH 连接
- env:
- DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
- DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
- DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
- DEPLOY_PATH: ${{ secrets.WEB_DEPLOY_PATH }}
- run: node .build/deploy-to-server.js --test
- - name: 构建 H5 (Web 部署 - Nginx 代理模式)
- shell: powershell
- env:
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
- TARO_API_URL: ''
- TARO_MQTT_URL: '/mqtt'
- run: |
- Write-Host "🌐 Web 部署模式 (Nginx 代理)"
- Write-Host " 使用 h5_for_production.js 构建脚本"
- Write-Host " API URL: 空字符串 (nginx根据路径转发)"
- Write-Host " MQTT URL: /mqtt (nginx代理转发)"
- Write-Host ""
- Write-Host "当前操作系统平台: Windows"
- Write-Host "当前CPU架构: $env:PROCESSOR_ARCHITECTURE"
- node .build/h5_for_production.js
- - name: 部署到服务器
- env:
- DEPLOY_KEY: ${{ secrets.DEPLOY_KEY }}
- DEPLOY_HOST: ${{ secrets.DEPLOY_HOST }}
- DEPLOY_USER: ${{ secrets.DEPLOY_USER }}
- DEPLOY_PATH: ${{ secrets.WEB_DEPLOY_PATH }}
- run: node .build/deploy-to-server.js
|