From b266dd9e993a4cc582bfee6e0d9936d566ca7d10 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E7=81=B0=E7=99=BD=E8=8D=89?= <41500176+HBcao233@users.noreply.github.com> Date: Mon, 8 Jan 2024 22:07:42 +0800 Subject: [PATCH] Update deploy.yml --- .github/workflows/deploy.yml | 54 ++++++++++++++++++++++++------------ 1 file changed, 37 insertions(+), 17 deletions(-) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 727b98e1..619fc8f7 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -1,26 +1,46 @@ -name: Deploy +name: pushDocs on: + // 配置当push进入什么分支的时候执行 push: - branches: - - main + branches: + - main + jobs: - deploy: + # This workflow contains a single job called "build" + build: + # The type of runner that the job will run on runs-on: ubuntu-latest - steps: - - uses: actions/checkout@v2 - - uses: actions/setup-node@v3 - with: - node-version: 16 - - run: npm i pnpm -g - - run: pnpm install --no-frozen-lockfile - - name: Build - run: pnpm docs:build + // 具体的执行步骤 + steps: + # Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it + - name: Checkout + uses: actions/checkout@main - - name: Deploy - uses: peaceiris/actions-gh-pages@v3 + // 使用的node版本 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@main with: - github_token: ${{ secrets.KEY }} - publish_dir: docs/.vitepress/dist \ No newline at end of file + node-version: ${{ matrix.node }} + + // 执行安装 + - name: Install dependencies + run: npm install + + // 执行打包 + - name: Build VuePress + run: npm run build + + // 执行部署 + - name: Deploy to Pages + run: | + cd .vitepress/dist + git init + git config user.name "gelxgx" + git config user.email "${{ secrets.GIT_EMAIL }}" + git add -A + git commit -m 'deploy' + git push -f https://gelxgx:${{ secrets.ACCESS_TOKEN }}@github.com/gelxgx/blog.git master:gh-pages + cd -