| 123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657 |
- name: CI 自动构建win h5,并上传到服务器
- on:
- push:
- branches:
- - master
- repository_dispatch:
- types:
- - webhook_trigger
- # 并发控制:自动取消旧的运行
- concurrency:
- group: build-win-h5-only-${{ github.ref }}
- cancel-in-progress: true
- jobs:
- build-h5-production:
- 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.DEPLOY_PATH }}
- run: node .build/deploy-to-server.js --test
- - name: 构建 H5 (生产环境)
- shell: powershell
- env:
- GH_TOKEN: ${{ secrets.GH_TOKEN }}
- TARO_API_URL: 'http://localhost:6001'
- TARO_MQTT_URL: 'ws://localhost:8083/mqtt'
- run: |
- Write-Host "当前操作系统平台: Windows"
- Write-Host "当前CPU架构: $env:PROCESSOR_ARCHITECTURE"
- # Windows 环境不需要 ARM 平台特殊处理
- 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.DEPLOY_PATH }}
- run: node .build/deploy-to-server.js
|