Do I need the pages-build-deployment Github Action, when I have another action for my Github Pages?

Rob*_*bin 11 github github-pages github-actions

In the settings I've enabled Github Pages:

Settings

I have a Github Action which builds and deploy the page to the branch gh-pages.

name: Continuous Deployment

on:
  push:
    branches:
      - master
  schedule:
    - cron: '0 0 * * *'

jobs:
  build-and-deploy:
    name: Build and deploy to Github Pages
    runs-on: ubuntu-latest
    steps:
      - name: Checkout repo
        uses: actions/checkout@v3
      - name: Use nodejs
        uses: actions/setup-node@v3
        with:
          node-version: '16.x'
      - name: Get yarn cache directory path
        id: yarn-cache-dir-path
        run: echo "::set-output name=dir::$(yarn cache dir)"
      - name: Activate dependency cache
        uses: actions/cache@v3
        id: yarn-cache # use this to check for `cache-hit` (`steps.yarn-cache.outputs.cache-hit != 'true'`)
        with:
          path: ${{ steps.yarn-cache-dir-path.outputs.dir }}
          key: ${{ runner.os }}-yarn-${{ hashFiles('**/yarn.lock') }}
          restore-keys: |
            ${{ runner.os }}-yarn-
      - name: Install dependencies
        run: yarn install --frozen-lockfile
      - name: Caching Gatsby
        id: gatsby-cache-build
        uses: actions/cache@v3
        with:
          path: |
            public
            .cache
          key: ${{ runner.os }}-gatsby-build-cache-${{ github.run_id }}
          restore-keys: |
            ${{ runner.os }}-gatsby-build-cache-
      - name: Build website
        run: yarn build:with-prefix
        env:
          PATH_PREFIX: '/xyz'
          SITE_URL: 'https://xyz.github.io/xyz'
          CI: true
      - name: Deploy to GitHub Pages
        uses: JamesIves/github-pages-deploy-action@v4.3.3
        with:
          branch: gh-pages
          folder: public
          clean: true
Run Code Online (Sandbox Code Playgroud)

Now there is another Github Action which seem to deploy my page to Github Actions (using Jakyll):

Github Actions

Now I have two questions, which I couldn't answer by searching the internet:

  1. Do I need this other action pages-build-deployment?
  2. If not, how can I disable it?
  3. If yes, for what it's needed? Am I doing the same work twice?

Von*_*onC 8

\n

我需要其他操作页面构建部署吗?

\n
\n

这是由 GitHub 自动提供的。
\n如JamesIves/github-pages-deploy-action#1073中所述:

\n
\n
\n

我认为,当页面构建和部署也将在每个推送和推送页面资产上运行时,此操作的用户会产生很大的困惑。

\n
\n

我认为,在 GitHub 宣布这些行动的长期目标之前,现在不可能真正说出具体情况。

\n

正如帖子所暗示的,这是推送完成后发生的必要步骤,这已经在幕后发生了,只是不可见。

\n
\n

所以你可以忽略它(并且没有明显的方法来禁用它)。
\n至于做同样的工作两次,同一篇文章补充道:

\n
\n

过去发生的情况是,我们在幕后使用 来github-pages[bot]拉取该分支并将内容部署到github-pages我们自动为您创建的环境中。

\n

现在,此步骤通过新的操作工作流程透明地进行。

\n

我们\xe2\x80\x99正在努力的最终目标是,如果您\xe2\x80\x99更喜欢直接部署到页面环境(而不将内容提交到分支gh-pages),您\xe2\x80\x99将能够在您自己的工作流程中执行此操作。这将消除我们在提交到页面分支时触发的第二个工作流程的需要。

\n
\n

上下文:2021 年 12 月“ GitHub Pages:使用 GitHub Actions 进行公共存储库的构建和部署”。

\n
\n

此更改的最初好处是使您能够查看构建日志以及可能发生的任何错误,这对于 Pages 用户来说是一个长期存在的问题。

\n

但是,将来这将使我们能够让您完全自定义页面构建和部署工作流程,以使用您想要的任何静态站点生成器,而无需将构建输出推送到存储库的特殊分支。

\n
\n


小智 5

现在您可以转到 GitHub 存储库的设置页面,然后转到“页面”。然后将“构建和部署”的“来源”更改为 GitHub Actions。之后,烦人的页面构建部署工作流程将不再自动触发。

github 仓库设置页面