From abd6b7a23c0034267c73bae6f3a4eb3fe8b60ea7 Mon Sep 17 00:00:00 2001 From: 01Petard <1520394133@qq.com> Date: Mon, 4 Nov 2024 20:54:48 +0800 Subject: [PATCH 1/4] Create jekyll-gh-pages.yml --- .github/workflows/jekyll-gh-pages.yml | 97 +++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .github/workflows/jekyll-gh-pages.yml diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml new file mode 100644 index 0000000..51f5894 --- /dev/null +++ b/.github/workflows/jekyll-gh-pages.yml @@ -0,0 +1,97 @@ +name: Deploy Pages + +# 触发条件,push到main分支或者pull request到main分支 +on: + push: + branches: [main] + pull_request: + branches: [main] + + # 支持手动在工作流上触发 + workflow_dispatch: + +# 设置时区 +env: + TZ: Asia/Shanghai + +# 权限设置 +permissions: + # 允许读取仓库内容的权限。 + contents: read + # 允许写入 GitHub Pages 的权限。 + pages: write + # 允许写入 id-token 的权限。 + id-token: write + +# 并发控制配置 +concurrency: + group: pages + cancel-in-progress: false + +# 定义执行任务 +jobs: + # 构建任务 + build: + + runs-on: ubuntu-latest + + # node v20 运行 + strategy: + matrix: + node-version: [20] + + steps: + # 拉取代码 + - name: Checkout + uses: actions/checkout@v3 + with: + # 保留 Git 信息 + fetch-depth: 0 + + # 设置使用 Node.js 版本 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + # 使用 最新的 PNPM + # 你也可以指定为具体的版本 + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: latest + # version: 9 + run_install: false + + # 安装依赖 + - name: Install dependencies + run: pnpm install --frozen-lockfile + + # 构建项目 + - name: Build blog project + run: | + echo ${{ github.workspace }} + pnpm build + + # 资源拷贝 + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: ./docs/.vitepress/dist + destination: ./_site + + # 上传 _site 的资源,用于后续部署 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + # 部署任务 + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4 From 67d33c3d955fc761163fc0e1b15cde0fb60aebb4 Mon Sep 17 00:00:00 2001 From: 01Petard <1520394133@qq.com> Date: Mon, 4 Nov 2024 20:56:43 +0800 Subject: [PATCH 2/4] Delete .github/workflows/jekyll-gh-pages.yml --- .github/workflows/jekyll-gh-pages.yml | 97 --------------------------- 1 file changed, 97 deletions(-) delete mode 100644 .github/workflows/jekyll-gh-pages.yml diff --git a/.github/workflows/jekyll-gh-pages.yml b/.github/workflows/jekyll-gh-pages.yml deleted file mode 100644 index 51f5894..0000000 --- a/.github/workflows/jekyll-gh-pages.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Deploy Pages - -# 触发条件,push到main分支或者pull request到main分支 -on: - push: - branches: [main] - pull_request: - branches: [main] - - # 支持手动在工作流上触发 - workflow_dispatch: - -# 设置时区 -env: - TZ: Asia/Shanghai - -# 权限设置 -permissions: - # 允许读取仓库内容的权限。 - contents: read - # 允许写入 GitHub Pages 的权限。 - pages: write - # 允许写入 id-token 的权限。 - id-token: write - -# 并发控制配置 -concurrency: - group: pages - cancel-in-progress: false - -# 定义执行任务 -jobs: - # 构建任务 - build: - - runs-on: ubuntu-latest - - # node v20 运行 - strategy: - matrix: - node-version: [20] - - steps: - # 拉取代码 - - name: Checkout - uses: actions/checkout@v3 - with: - # 保留 Git 信息 - fetch-depth: 0 - - # 设置使用 Node.js 版本 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - # 使用 最新的 PNPM - # 你也可以指定为具体的版本 - - uses: pnpm/action-setup@v2 - name: Install pnpm - with: - version: latest - # version: 9 - run_install: false - - # 安装依赖 - - name: Install dependencies - run: pnpm install --frozen-lockfile - - # 构建项目 - - name: Build blog project - run: | - echo ${{ github.workspace }} - pnpm build - - # 资源拷贝 - - name: Build with Jekyll - uses: actions/jekyll-build-pages@v1 - with: - source: ./docs/.vitepress/dist - destination: ./_site - - # 上传 _site 的资源,用于后续部署 - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - - # 部署任务 - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 From e0be0fe7db85d21c7f2b7b112180e23759218524 Mon Sep 17 00:00:00 2001 From: 01Petard <1520394133@qq.com> Date: Mon, 4 Nov 2024 20:57:00 +0800 Subject: [PATCH 3/4] Delete .github/workflows/deploy.yml --- .github/workflows/deploy.yml | 97 ------------------------------------ 1 file changed, 97 deletions(-) delete mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml deleted file mode 100644 index 51f5894..0000000 --- a/.github/workflows/deploy.yml +++ /dev/null @@ -1,97 +0,0 @@ -name: Deploy Pages - -# 触发条件,push到main分支或者pull request到main分支 -on: - push: - branches: [main] - pull_request: - branches: [main] - - # 支持手动在工作流上触发 - workflow_dispatch: - -# 设置时区 -env: - TZ: Asia/Shanghai - -# 权限设置 -permissions: - # 允许读取仓库内容的权限。 - contents: read - # 允许写入 GitHub Pages 的权限。 - pages: write - # 允许写入 id-token 的权限。 - id-token: write - -# 并发控制配置 -concurrency: - group: pages - cancel-in-progress: false - -# 定义执行任务 -jobs: - # 构建任务 - build: - - runs-on: ubuntu-latest - - # node v20 运行 - strategy: - matrix: - node-version: [20] - - steps: - # 拉取代码 - - name: Checkout - uses: actions/checkout@v3 - with: - # 保留 Git 信息 - fetch-depth: 0 - - # 设置使用 Node.js 版本 - - name: Use Node.js ${{ matrix.node-version }} - uses: actions/setup-node@v3 - with: - node-version: ${{ matrix.node-version }} - - # 使用 最新的 PNPM - # 你也可以指定为具体的版本 - - uses: pnpm/action-setup@v2 - name: Install pnpm - with: - version: latest - # version: 9 - run_install: false - - # 安装依赖 - - name: Install dependencies - run: pnpm install --frozen-lockfile - - # 构建项目 - - name: Build blog project - run: | - echo ${{ github.workspace }} - pnpm build - - # 资源拷贝 - - name: Build with Jekyll - uses: actions/jekyll-build-pages@v1 - with: - source: ./docs/.vitepress/dist - destination: ./_site - - # 上传 _site 的资源,用于后续部署 - - name: Upload artifact - uses: actions/upload-pages-artifact@v3 - - # 部署任务 - deploy: - environment: - name: github-pages - url: ${{ steps.deployment.outputs.page_url }} - runs-on: ubuntu-latest - needs: build - steps: - - name: Deploy to GitHub Pages - id: deployment - uses: actions/deploy-pages@v4 From ac188aa411c24fe72acb97c0ba04bb079e5f34de Mon Sep 17 00:00:00 2001 From: 01Petard <1520394133@qq.com> Date: Mon, 4 Nov 2024 21:02:55 +0800 Subject: [PATCH 4/4] Create deploy.yml --- .github/workflows/deploy.yml | 97 ++++++++++++++++++++++++++++++++++++ 1 file changed, 97 insertions(+) create mode 100644 .github/workflows/deploy.yml diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml new file mode 100644 index 0000000..51f5894 --- /dev/null +++ b/.github/workflows/deploy.yml @@ -0,0 +1,97 @@ +name: Deploy Pages + +# 触发条件,push到main分支或者pull request到main分支 +on: + push: + branches: [main] + pull_request: + branches: [main] + + # 支持手动在工作流上触发 + workflow_dispatch: + +# 设置时区 +env: + TZ: Asia/Shanghai + +# 权限设置 +permissions: + # 允许读取仓库内容的权限。 + contents: read + # 允许写入 GitHub Pages 的权限。 + pages: write + # 允许写入 id-token 的权限。 + id-token: write + +# 并发控制配置 +concurrency: + group: pages + cancel-in-progress: false + +# 定义执行任务 +jobs: + # 构建任务 + build: + + runs-on: ubuntu-latest + + # node v20 运行 + strategy: + matrix: + node-version: [20] + + steps: + # 拉取代码 + - name: Checkout + uses: actions/checkout@v3 + with: + # 保留 Git 信息 + fetch-depth: 0 + + # 设置使用 Node.js 版本 + - name: Use Node.js ${{ matrix.node-version }} + uses: actions/setup-node@v3 + with: + node-version: ${{ matrix.node-version }} + + # 使用 最新的 PNPM + # 你也可以指定为具体的版本 + - uses: pnpm/action-setup@v2 + name: Install pnpm + with: + version: latest + # version: 9 + run_install: false + + # 安装依赖 + - name: Install dependencies + run: pnpm install --frozen-lockfile + + # 构建项目 + - name: Build blog project + run: | + echo ${{ github.workspace }} + pnpm build + + # 资源拷贝 + - name: Build with Jekyll + uses: actions/jekyll-build-pages@v1 + with: + source: ./docs/.vitepress/dist + destination: ./_site + + # 上传 _site 的资源,用于后续部署 + - name: Upload artifact + uses: actions/upload-pages-artifact@v3 + + # 部署任务 + deploy: + environment: + name: github-pages + url: ${{ steps.deployment.outputs.page_url }} + runs-on: ubuntu-latest + needs: build + steps: + - name: Deploy to GitHub Pages + id: deployment + uses: actions/deploy-pages@v4