简体   繁体   English

当我的 Github 页面有其他操作时,我是否需要 pages-build-deployment Github 操作?

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

In the settings I've enabled Github Pages:在设置中我启用了 Github Pages:

设置

I have a Github Action which builds and deploy the page to the branch gh-pages .我有一个 Github Action,它构建页面并将其部署到分支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

Now there is another Github Action which seem to deploy my page to Github Actions (using Jakyll):现在有另一个 Github Action 似乎将我的页面部署到 Github Actions(使用 Jakyll):

Github 操作

Now I have two questions, which I couldn't answer by searching the internet:现在我有两个问题,我无法通过搜索互联网来回答:

  1. Do I need this other action pages-build-deployment ?我是否需要其他操作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?我做同样的工作两次吗?

Do I need this other action pages-build-deployment?我是否需要其他操作页面-构建-部署?

This is provided by GitHub automatically.这是由 GitHub 自动提供的。
As discussed in JamesIves/github-pages-deploy-action #1073 :正如JamesIves/github-pages-deploy-action #1073中所讨论的:

I think there's a lot of scope for confusion for users of this action, when pages build and deployment will also be running on every push and pushing pages assets.我认为此操作的用户有很大的混淆空间,当页面构建和部署也将在每次推送和推送页面资产上运行时。

I think it's impossible to really say right now what that looks like until GitHub announces what these actions intend to do in the long run.我认为在 GitHub 宣布这些行动从长远来看打算做什么之前,现在不可能真正说出这是什么样的。

As the post suggests , this is a necessary step that occurs after the push gets made, this was already occurring behind the scenes it just wasn't made visible. 正如帖子所暗示的那样,这是在推送完成后发生的必要步骤,这已经在幕后发生了,只是不可见。

So you can ignore it (and there is no obvious way to disable it).所以你可以忽略它(并且没有明显的方法可以禁用它)。
As for doing the same work twice, the same post adds:至于两次做同样的工作,同一篇文章补充道:

What used to happen is, behind the scenes , we used the github-pages[bot] to pull that branch down and deploy the content to the github-pages environment we create for you automatically.过去发生的事情是,在幕后,我们使用github-pages[bot]拉下该分支并将内容部署到我们自动为您创建的github-pages环境中。

Now this step happens transparently with this new Actions workflow.现在,此步骤通过新的 Actions 工作流程透明地发生。

The end goal we're working on is, if you'd prefer to deploy to the pages environment directly (without committing the content to a gh-pages branch), you'll be able to do that in your own workflow.我们正在努力的最终目标是,如果您希望直接部署到 pages 环境(而不将内容提交到gh-pages分支),您将能够在自己的工作流程中做到这一点。 This will remove the need for the second workflow that we trigger when you commit to the pages branch.这将消除我们在提交到页面分支时触发的第二个工作流的需要。

Context: Dec. 2021 " GitHub Pages: using GitHub Actions for builds and deployments for public repositories ".背景:2021 年 12 月“ GitHub Pages:使用 GitHub Actions 构建和部署公共存储库”。

The initial benefit of this change is enabling you to see your build logs and any errors that may occur which has been a long standing issue for Pages users.此更改的最初好处是使您能够查看构建日志以及可能发生的任何错误,这对于 Pages 用户来说是长期存在的问题。

However, in the future this will enable us to give you the ability to fully customize your pages build and deployment workflow to use any static site generator you want without having to push the build output to a special branch of the repository.但是,在未来,这将使我们能够让您完全自定义您的页面构建和部署工作流程,以使用您想要的任何静态站点生成器,而无需将构建输出推送到存储库的特殊分支。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 GitHub 操作:执行页面-构建-部署 - GitHub actions: going through with pages-build-deployment 我需要为 Github 页面构建 Jekyll 吗? - Do I need to build Jekyll for Github pages? 尝试对 github 页面执行 github 操作的 Blazor 部署(操作失败,“ENOENT:没有此类文件或目录,scandir) - Trying Blazor deployment with github action on github pages (Action failed with "ENOENT: no such file or directory, scandir) 我已经在 GitHub 上部署了我的 Tailwind CSS 项目,但它突然停止了页面部署 - I have deployed my Tailwind CSS project on GitHub and it suddenly stopped working on pages deployment 为什么在 github 页面上部署我的网站时出现无法创建部署错误 - why do i am getting Failed to create deployment error while deploying my website on github pages 我需要付费来更改github页面域吗? - Do I need to pay to change github pages domain? 我的 github 操作一直失败,我不知道为什么 - My github action keeps failing and I have no idea why 如何将我的 CSS 链接到 Github 页面中的 HTML 文件? - How do I link my CSS to the HTML file in Github Pages? 如何取消 GitHub Pages 重定向? - How do I cancel GitHub Pages redirection? 如何在 Github 页面上发布我的 React 站点? - How do I publish my React site on Github Pages?
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM