diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml new file mode 100644 index 0000000..911a28b --- /dev/null +++ b/.github/workflows/build.yml @@ -0,0 +1,47 @@ +name: Build Frontend + +on: + push: + branches: + - main + - master + workflow_dispatch: + +jobs: + build: + runs-on: ubuntu-latest + + steps: + # 1. 拉取代码 + - name: Checkout repository + uses: actions/checkout@v4 + + # 2. 安装 pnpm + - name: Install pnpm + uses: pnpm/action-setup@v3 + with: + version: 8 + + # 3. 设置 Node.js 环境 + - name: Setup Node.js + uses: actions/setup-node@v4 + with: + node-version: '20' + cache: 'pnpm' + + # 4. 安装依赖 + - name: Install dependencies + run: pnpm install + + # 5. 执行编译打包 + - name: Build project + run: pnpm run build + + # 6. 上传编译产物 + - name: Upload build artifact + uses: actions/upload-artifact@v4 + with: + name: dist-build + path: | + dist + dist/