在设置中我启用了 Github 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/[email protected] /cdn-cgi/l/email-protection
with:
branch: gh-pages
folder: public
clean: true
现在有另一个 Github Action 似乎将我的页面部署到 Github Actions(使用 Jakyll):
现在我有两个问题,通过互联网搜索无法回答:
- 我需要采取其他行动吗
pages-build-deployment
?
- 如果没有,我该如何禁用它?
- 如果是的话,需要什么?我是否做同样的工作两次?
我需要其他操作页面构建部署吗?
这是由 GitHub 自动提供的。
正如中所讨论的JamesIves/github-pages-deploy-action #1073 https://github.com/JamesIves/github-pages-deploy-action/discussions/1073:
我认为,当页面构建和部署也将在每个推送和推送页面资产上运行时,此操作的用户会产生很大的困惑。
我认为,在 GitHub 宣布这些行动的长期目标之前,现在不可能真正说出具体情况。
正如帖子所暗示的那样 https://github.community/t/github-pages-bot-added-to-our-repos-unannounced/218214/8,这是推送完成后发生的必要步骤,这已经在幕后发生了,只是不可见。
所以你可以忽略它(并且没有明显的方法来禁用它)。
至于做同样的工作两次,同一篇文章补充道:
过去发生的事情是,幕后,我们使用了github-pages[bot]
将该分支拉下来并将内容部署到github-pages
我们自动为您创建的环境。
现在,此步骤通过新的操作工作流程透明地进行。
我们正在努力的最终目标是,如果您希望直接部署到页面环境(而不将内容提交到gh-pages
分支),您将能够在自己的工作流程中执行此操作。这将消除当您提交到页面分支时我们触发的第二个工作流程的需要。
背景:2021 年 12 月“GitHub Pages:使用 GitHub Actions 进行公共存储库的构建和部署 https://github.blog/changelog/2021-12-16-github-pages-using-github-actions-for-builds-and-deployments-for-public-repositories/".
此更改的最初好处是使您能够查看构建日志以及可能发生的任何错误,这对于 Pages 用户来说是一个长期存在的问题。
但是,将来这将使我们能够让您完全自定义页面构建和部署工作流程,以使用您想要的任何静态站点生成器,而无需将构建输出推送到存储库的特殊分支。
本文内容由网友自发贡献,版权归原作者所有,本站不承担相应法律责任。如您发现有涉嫌抄袭侵权的内容,请联系:hwhale#tublm.com(使用前将#替换为@)