name: Build # 当前阶段只做构建验证:不部署 nginx、不发 Release # 热更新包与生产部署在后续阶段以独立 workflow 接入 on: pull_request: branches: - master types: - closed workflow_dispatch: jobs: build: runs-on: act_runner_node if: ${{ github.event_name == 'workflow_dispatch' || github.event.pull_request.merged == true }} steps: - name: Checkout code uses: actions/checkout@v4 - name: Configure nexus auth env: NEXUS_USERNAME: ${{ secrets.NEXUS_USERNAME }} NEXUS_PASSWORD: ${{ secrets.NEXUS_PASSWORD }} run: | if [ -z "$NEXUS_USERNAME" ] || [ -z "$NEXUS_PASSWORD" ]; then echo "FAIL: 缺少 secrets.NEXUS_USERNAME 或 secrets.NEXUS_PASSWORD" exit 1 fi auth=$(printf '%s:%s' "$NEXUS_USERNAME" "$NEXUS_PASSWORD" | base64 | tr -d '\n') { echo "registry=https://nexus.imyeyu.com/repository/npm-group/" echo "//nexus.imyeyu.com/repository/npm-group/:_auth=${auth}" echo "//nexus.imyeyu.com/repository/npm-group/:always-auth=true" echo "//nexus.imyeyu.com/repository/npm-timi/:_auth=${auth}" echo "//nexus.imyeyu.com/repository/npm-timi/:always-auth=true" } > ~/.npmrc echo "OK: nexus 认证已配置" - name: Install dependencies run: pnpm install --frozen-lockfile - name: Build run: pnpm run build - name: Report output run: | echo "dist 大小: $(du -sh dist | cut -f1)" echo "文件数: $(find dist -type f | wc -l)" if [ -f dist/index.html ]; then echo "index.html: 存在" else echo "FAIL: dist/index.html 缺失,产物不可用于热更新" exit 1 fi