- Objective:
- Breadcrumb:
# 概念阐释
GitHub Action一个持续集成和持续部署(CI/CD[^1])的平台,它可以让开发者自定义[[工作流]],让有工作流文件的仓库自动运行。
# 实例
#### 通过[lychee](https://github.com/lycheeverse/lychee-action)工具检查链接
检查Markdown、HTML和文本文件中的链接
- 在文件夹的根目录中创建`.github/workflows/check_links.yml`,以下是.yml的内容
```yml
# Quickly check links in Markdown, HTML, and text files using lychee.
# https://github.com/lycheeverse/lychee-action
name: Check Links
on:
repository_dispatch:
workflow_dispatch:
schedule:
- cron: '"0 0 * * *"' # 每天午夜UTC12点更新,"00 18 * * *"18:00更新
jobs:
linkChecker:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Link Checker
id: lychee
uses: lycheeverse/
[email protected]
env:
GITHUB_TOKEN: ${{secrets.GITHUB_TOKEN}}
with:
args: --verbose --no-progress './**/*.md' --accept 200,201,204,206,401,403,406,429,999 --exclude-path './Templates' #不包括的文件夹
- name: Create Issue From File
if: steps.lychee.outputs.exit_code != 0
uses: peter-evans/create-issue-from-file@v4
with:
title: Link Checker Report
content-filepath: ./lychee/out.md
labels: report, automated issue
```
- 在终端中提交工作流
```bash
git add .github/workflows/release.yml
git commit -m "Add release workflow"
git push origin main
```
- Browse to your repository on GitHub and select the **Actions** tab. Your workflow might still be running, or it might have finished already.
- When the workflow finishes, go back to the main page for your repository and select **Releases** in the sidebar on the right side. The workflow has created a draft GitHub release and uploaded the required assets as binary attachments.
#### 使用GitHub Actions自动发布到 Cloudflare Pages
[clip](https://github.com/theowenyoung/clip/tree/main)
# 相关内容
## CI/CD
^f8042b
1. 持续集成Continuous Integration: 将新的代码集成到已有的代码中,每周更新一个版本,甚至一条更新几个版本;
2. 持续部署Continuous Deployment:持续交付的新版本通过自动化测试后自动部署到开发环境下。

# 参考资料
### ref.
小谭:“通过Obsidian Git定期把仓库上传到GitHub,然后用GitHub Actions来触发cloudflare pages(静态网站托管)的重新构建,实现网站的自动更新。”
https://pages.cloudflare.com/
JAMstack平台是一种基于JAMstack架构的Web应用程序开发平台。JAMstack是一种现代的Web开发架构,它将JavaScript、API和静态网页生成器结合在一起,以提供快速、安全和可靠的Web应用程序。JAMstack平台通常包括静态网页生成器、API服务、CDN、云存储和其他工具,以帮助开发人员构建和部署高性能、可扩展和易于维护的Web应用程序。JAMstack平台的优点包括更快的加载速度、更好的安全性和更低的成本。
GitHub pages也是JAMstack架构
- [codecademy-管理GitHub仓库](https://www.codecademy.com/journeys/full-stack-engineer/paths/fscj-22-front-end-development/tracks/fscj-22-git-and-github-part-ii/modules/wdcp-22-best-practices-for-github-repositories-e4ea0f25-b3dd-46bb-a2a3-3f7aa9b2c5da/articles/managing-a-github-repository)
- [data-engineering-community](https://github.com/data-engineering-community/data-engineering-wiki/blob/main/.github/workflows/check_links.yml)
- [lychee]([GitHub - lycheeverse/lychee-action:Github操作,使用lychee检查Markdown,HTML和文本文件中的断开链接,荔枝是用Rust编写的快速链接检查器。](https://github.com/lycheeverse/lychee-action))
- [Release your plugin with GitHub Actions-Obsidian](https://docs.obsidian.md/Plugins/Releasing/Release+your+plugin+with+GitHub+Actions)
- [Release your theme with GitHub Actions](Release your theme with GitHub Actions)