From dcdea10424e182a429fd45a1d95a4d2271d8943f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E5=BC=A0=E9=B1=BC=E7=83=A7=E3=80=82?= <827265905@qq.com> Date: Mon, 10 Feb 2025 17:20:19 +0800 Subject: [PATCH] =?UTF-8?q?feat(feat):=20"=E8=B0=83=E6=95=B4=E7=9B=AE?= =?UTF-8?q?=E5=BD=95=E7=BB=93=E6=9E=84=EF=BC=8C=E4=BC=98=E5=8C=96=E9=A1=B9?= =?UTF-8?q?=E7=9B=AE"?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CD.yml | 39 ++++++++++++++++++++++++++++++++------- 1 file changed, 32 insertions(+), 7 deletions(-) diff --git a/.github/workflows/CD.yml b/.github/workflows/CD.yml index dead3ce..36e5193 100644 --- a/.github/workflows/CD.yml +++ b/.github/workflows/CD.yml @@ -28,23 +28,48 @@ jobs: url: ${{ steps.deployment.outputs.page_url }} runs-on: ubuntu-latest steps: + # 检出代码 - name: Checkout uses: actions/checkout@v3 - - uses: actions/checkout@v2 - - uses: pnpm/action-setup@v2.1.0 + + # 设置 pnpm + - name: Set up pnpm + uses: pnpm/action-setup@v2.1.0 with: version: 8.6.2 - - name: Install modules + + # 缓存 pnpm 的 node_modules,提升构建速度 + - name: Cache pnpm modules + uses: actions/cache@v3 + with: + path: ~/.pnpm-store + key: ${{ runner.os }}-pnpm-store-${{ hashFiles('**/pnpm-lock.yaml') }} + restore-keys: | + ${{ runner.os }}-pnpm-store- + + # 安装依赖 + - name: Install dependencies run: pnpm install --no-frozen-lockfile - - name: Build + + # 构建项目 + - name: Build project run: pnpm run build + + # 设置 Pages - name: Setup Pages uses: actions/configure-pages@v4 + + # 检查目录存在性 + - name: List build directory + run: ls -R ./sample/dist + + # 上传构建产物 - name: Upload artifact uses: actions/upload-pages-artifact@v3 with: - # Upload dist repository - path: "./sample/dist" + path: ${{ github.workspace }}/sample/dist/ + + # 部署到 GitHub Pages - name: Deploy to GitHub Pages id: deployment - uses: actions/deploy-pages@v3 + uses: actions/deploy-pages@v3 \ No newline at end of file