mirror of
https://git.bjxgj.com/xgj/xgj-actions.git
synced 2025-10-14 06:33:37 +08:00
90 lines
1.9 KiB
YAML
90 lines
1.9 KiB
YAML
# 多项目/多目录示例
|
|
name: 多项目构建
|
|
|
|
on:
|
|
push:
|
|
branches: [ main ]
|
|
|
|
jobs:
|
|
frontend:
|
|
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: 'yarn'
|
|
node-modules-path: './frontend/node_modules'
|
|
cache-prefix: 'frontend'
|
|
|
|
- name: 构建前端
|
|
working-directory: ./frontend
|
|
run: yarn build
|
|
|
|
- name: 前端测试
|
|
working-directory: ./frontend
|
|
run: yarn test
|
|
|
|
backend:
|
|
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'
|
|
node-modules-path: './backend/node_modules'
|
|
cache-prefix: 'backend'
|
|
|
|
- name: 后端测试
|
|
working-directory: ./backend
|
|
run: npm test
|
|
|
|
- name: 构建后端
|
|
working-directory: ./backend
|
|
run: npm run build
|
|
|
|
docs:
|
|
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: 'pnpm'
|
|
node-modules-path: './docs/node_modules'
|
|
cache-prefix: 'docs'
|
|
|
|
- name: 构建文档
|
|
working-directory: ./docs
|
|
run: pnpm build
|
|
|
|
- name: 部署文档
|
|
if: github.ref == 'refs/heads/main'
|
|
working-directory: ./docs
|
|
run: pnpm deploy
|