# 自定义安装命令示例 name: 自定义安装命令 on: push: branches: [ production ] jobs: production-build: runs-on: ubuntu-latest steps: - name: 检出代码 uses: actions/checkout@v4 - name: 设置Node.js uses: actions/setup-node@v4 with: node-version: '18' - name: 生产环境依赖安装 uses: actions/xgj/npm-install@v1 with: package-manager: 'npm' install-command: 'npm ci --only=production --ignore-scripts' cache-prefix: 'production' - name: 验证依赖 run: | echo "检查生产依赖..." npm ls --depth=0 --only=production - name: 构建生产版本 run: npm run build:production - name: 运行生产测试 run: npm run test:production development-build: runs-on: ubuntu-latest steps: - name: 检出代码 uses: actions/checkout@v4 - name: 设置Node.js uses: actions/setup-node@v4 with: node-version: '18' - name: 开发环境依赖安装 uses: actions/xgj/npm-install@v1 with: package-manager: 'npm' install-command: 'npm install --include=dev' cache-prefix: 'development' - name: 运行开发工具 run: | npm run lint npm run test:coverage