Rob*_*bin 11 github github-pages github-actions
In the settings I've enabled Github Pages:
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):
Now I have two questions, which I couldn't answer by searching the internet:
pages-build-deployment
?\n\n我需要其他操作页面构建部署吗?
\n
这是由 GitHub 自动提供的。
\n如JamesIves/github-pages-deploy-action
#1073中所述:
\n\n\n\n我认为,当页面构建和部署也将在每个推送和推送页面资产上运行时,此操作的用户会产生很大的困惑。
\n我认为,在 GitHub 宣布这些行动的长期目标之前,现在不可能真正说出具体情况。
\n正如帖子所暗示的,这是推送完成后发生的必要步骤,这已经在幕后发生了,只是不可见。
\n
所以你可以忽略它(并且没有明显的方法来禁用它)。
\n至于做同样的工作两次,同一篇文章补充道:
\n\n过去发生的情况是,我们在幕后使用 来
\ngithub-pages[bot]
拉取该分支并将内容部署到github-pages
我们自动为您创建的环境中。现在,此步骤通过新的操作工作流程透明地进行。
\n我们\xe2\x80\x99正在努力的最终目标是,如果您\xe2\x80\x99更喜欢直接部署到页面环境(而不将内容提交到分支
\ngh-pages
),您\xe2\x80\x99将能够在您自己的工作流程中执行此操作。这将消除我们在提交到页面分支时触发的第二个工作流程的需要。
上下文:2021 年 12 月“ GitHub Pages:使用 GitHub Actions 进行公共存储库的构建和部署”。
\n\n\n此更改的最初好处是使您能够查看构建日志以及可能发生的任何错误,这对于 Pages 用户来说是一个长期存在的问题。
\n但是,将来这将使我们能够让您完全自定义页面构建和部署工作流程,以使用您想要的任何静态站点生成器,而无需将构建输出推送到存储库的特殊分支。
\n
归档时间: |
|
查看次数: |
2654 次 |
最近记录: |