github-pages - 自定义 GitHub 页面部署说明

有人可以向我指出为 GitHub 页面设置自定义部署的说明吗? (我的 Google 技能让我失望了。)

我有一个网站,当我在 GitHub Pages 上部署它时只需要修改一下:我想用 bar.com 替换所有出现的 foo.com。我知道前两步是

  1. 添加 .nojekyll 文件
  2. 配置 GitHub Actions 以检查存储库,然后对所有 .html 文件运行简单的搜索/替换脚本。

此时,我还需要做其他事情吗?添加我自己的自定义 .github 目录会影响/覆盖部署网站所需的任何操作吗?


(对于那些好奇的人:我知道我可以编写一个简单的 Jekyll 插件来执行此操作;但是,我宁愿不将 Jekyl 前端内容添加到我的文件中。另外,对于一,我需要简单的转换。)

最佳答案

考虑JamesIves/github-pages-deploy-action可以配置为将您的生产就绪代码推送到您想要的任何分支,另一种方法是您的操作:

  • 包含一个 steps: - name: Replace 将替换 checkout 的文本
  • 部署当前 checkout (和修改)的文件夹

对于第一点,您可以使用例如 find-and-replace action , 找到 foo.com 并将其替换为 bar.com


注意:由于您使用的是 GitHub 操作,因此您可以 specify said action as publishing source

You can now deploy to a GitHub Pages site directly from a repository using GitHub Actions, without needing to set up a publishing source.

Using Actions to orchestrate Pages publishing provides many more options for choosing your authoring framework (Next.js, Hugo, Gatsby, Jekyll, NuxtJS or other technologies, and the associated versions thereof) as well as giving you finer control over the publishing process, such as leveraging deployment gates.

We have written several starter workflows for the most common frameworks but also have a “Static“ option if you want to deploy the contents of your repository with no build step.

  • Documentation
  • Starter workflows (您可以修改 static.yml 以包含您的更改)

https://stackoverflow.com/questions/72922881/

相关文章:

java - 什么被认为是 Java 核心模块?

c++ - 参数的值类别在重载决策(或更一般的函数调用处理)的哪一部分中发挥作用?

c++ - 为什么 std::shared_ptr 控制 block 需要持有指向具有正确类型的托管

Python 修补类 - 方法 return_value 返回 MagicMock

python - 名称错误 : name 'scipy' is not defined when t

scrapy - 如何在 scrapy Shell 中使用 scrapy 中间件?

reactjs - 在进行客户端查询时,我应该如何为 Github graphql API 提供身份

javascript - react-animarker 突出显示不随状态更改而更新

reactjs - eslint 无法加载配置 "react-app"以从中扩展

algorithm - 计算具有整数边和给定斜边的直角三角形