From cd99f58f49486c3eb4eefae4a80ff0885dc44766 Mon Sep 17 00:00:00 2001 From: "142vip.cn" Date: Tue, 24 Sep 2024 14:32:33 +0800 Subject: [PATCH] =?UTF-8?q?perf(GitHub=20Actions):=20=E4=BC=98=E5=8C=96`CD?= =?UTF-8?q?`=E6=B5=81=E6=B0=B4=E7=BA=BF=EF=BC=8C=E6=9B=BF=E6=8D=A2`github?= =?UTF-8?q?=20pages`=E9=83=A8=E7=BD=B2=E6=B5=81=E7=A8=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/CD.yaml | 67 +++++++++++---------------------------- 1 file changed, 19 insertions(+), 48 deletions(-) diff --git a/.github/workflows/CD.yaml b/.github/workflows/CD.yaml index c9dbc4c..d18dcc5 100644 --- a/.github/workflows/CD.yaml +++ b/.github/workflows/CD.yaml @@ -31,66 +31,37 @@ jobs: # “最近更新时间” 等 git 日志相关信息,需要拉取全部提交记录 fetch-depth: 0 - ## 安装PNPM + # 安装PNPM - name: PNPM Install - uses: pnpm/action-setup@v2 + uses: pnpm/action-setup@v4 with: - version: 8 + version: 9.6.0 - ## 安装Node环境 + # 安装Node环境 - name: Install Node.js - uses: actions/setup-node@v3 + uses: actions/setup-node@v4 with: - node-version: 18.18.0 - ## 淘宝镜像加速 - registry-url: 'https://registry.npmmirror.com' - ## 缓存 - cache: 'pnpm' + node-version: 20.16.0 + # 缓存 + cache: pnpm - ## 下载依赖,并执行初始化脚本:钩子函数、思维导图构建 - name: Install Dependencies run: | ./scripts/ci - # 运行构建脚本 - - name: Build VuePress Site - run: | - ./scripts/bundle build_proxy + # 编译 打包成dist + - name: Build with VitePress + run: pnpm build:proxy - # 将README.md同步,利于github pages分支展示 - - name: Add Readme.md To Dist - run: | - cp -f README.md docs/.vuepress/dist - - - - name: Check GitHub Pages status - uses: crazy-max/ghaction-github-status@v3 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 with: - pages_threshold: major_outage + path: docs/.vuepress/dist - ## 获取Git提交信息 - - name: Get Commit Info - id: gitInfo - run: | - echo "version=$(node -p "require('./package.json').version")" >> $GITHUB_OUTPUT - echo "author=$(git log -1 --pretty=%an)" >> $GITHUB_OUTPUT - echo "email=$(git log -1 --pretty=%ae)" >> $GITHUB_OUTPUT - - ## 参考:https://github.com/marketplace/actions/github-pages - - name: Deploy To GitHub Page - uses: crazy-max/ghaction-github-pages@v3 - with: - target_branch: pages/github - build_dir: docs/.vuepress/dist - commit_message: | - chore(sync): v${{steps.gitInfo.outputs.version}} - - 部署地址: https://142vip.github.io/408CSFamily - committer: ${{steps.gitInfo.outputs.author}}<${{steps.gitInfo.outputs.email}}> - author: Mr·Sync - - env: - GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + # 部署 + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 ## 部署到vercel平台 deploy-vercel: @@ -205,4 +176,4 @@ jobs: # echo "-----------正在运行的服务--------" # docker ps # cd /service_env/ && git reset --hard && git pull origin main -# bash ./scripts/book_doc.deploy.sh jsc ${{steps.version.outputs.value}} \ No newline at end of file +# bash ./scripts/book_doc.deploy.sh jsc ${{steps.version.outputs.value}}