Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

构建基于 github ISSUE 的Blog #9

Open
hewking opened this issue Dec 1, 2024 · 0 comments
Open

构建基于 github ISSUE 的Blog #9

hewking opened this issue Dec 1, 2024 · 0 comments
Labels

Comments

@hewking
Copy link
Owner

hewking commented Dec 1, 2024

构建 blog

1. 生成 github developer setting token

2. 创建 github actions

配置 github workflow/ main.yml, 执行action 如果无法访问创建 pull-request 需要在项目中进行设置

  1. 设置 secrets.GH_Token: setting -> Secrets and variables -> Actions -> new repository secret
    1. Repository secrets 访问: secrets.GH_Token
    2. Environment variables 访问: GH_Token
  2. github actions 设置 pull-request 权限: repo -> settings -> actions -> general -> read and write permissions (Workflow permissions)

设置 pull-request 权限

3. 配置部署 jekyll

  1. 设置 Pages
    1. repo -> settings -> pages -> source -> deploy from branch -> branch: main
    2. 如果已经设置过 CNNAME,部署后会自动部署到原域名
  2. 配置 _config.yml
# 基础配置
title: Your Blog Title
description: Your blog description
theme: jekyll-theme-minimal  # 或其他主题

# Jekyll 设置
markdown: kramdown
kramdown:
  input: GFM
  syntax_highlighter: rouge

# 可选:排除不需要处理的文件
exclude:
  - generate.py
  - README.md
  - .github/

这样设置后,每次 PR merge 到主分支,GitHub 会自动:
检测到 markdown 文件变化
用 Jekyll 构建站点
部署到 GitHub Pages
不需要额外的 workflow 文件,GitHub 会自动处理构建和部署。在 actions 中会生成 workflow: pages-build-deployment

参考资料

@hewking hewking added the blog label Dec 1, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant