[英]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):
Now I have two questions, which I couldn't answer by searching the internet:现在我有两个问题,我无法通过搜索互联网来回答:
pages-build-deployment
?pages-build-deployment
?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 thegithub-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.