Skip to content

Generate EPUB with Pandoc #25

Generate EPUB with Pandoc

Generate EPUB with Pandoc #25

name: Generate EPUB with Pandoc
on:
push:
branches:
- master
- main
paths:
- 'docs/**/*.xhtml'
- 'Extra-Chapter/**/*.xhtml'
- 'docs/epub-style.css'
- '.github/workflows/generate-epub-pandoc.yml'
workflow_dispatch:
permissions:
contents: write
jobs:
generate-epub:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Install dependencies
run: |
sudo apt-get update
sudo apt-get install -y python3-pip
pip install ebooklib
- name: 生成 EPUB 电子书(ebooklib)
run: |
python3 .github/scripts/generate_epub.py
- name: Validate EPUB
run: |
wget https://github.com/w3c/epubcheck/releases/download/v5.1.0/epubcheck-5.1.0.zip
unzip epubcheck-5.1.0.zip
java -jar epubcheck-5.1.0/epubcheck.jar --failonwarnings=false happy-llm.epub || echo "EPUB validation completed with warnings"
- name: Upload EPUB artifact
uses: actions/upload-artifact@v4
with:
name: happy-llm-epub
path: happy-llm.epub
retention-days: 30
- name: Create or update release
uses: softprops/action-gh-release@v1
with:
files: "happy-llm.epub"
tag_name: "epub-${{ github.run_number }}"
name: "Happy-LLM EPUB ${{ github.run_number }}"
body: |
使用ebooklib自动生成的Happy-LLM电子书
包含内容:
- README
- 前言
- 第一章 NLP基础概念
- 第二章 Transformer架构
- 第三章 预训练语言模型
- 第四章 大语言模型
- 第五章 动手搭建大模型
- 第六章 大模型训练流程实践
- 第七章 大模型应用
- 额外章节内容(偏好对齐、模型微调、Transformer详解等)
生成工具:ebooklib
样式文件:docs/epub-style.css
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false
- name: Update latest release
if: github.ref == 'refs/heads/master' || github.ref == 'refs/heads/main'
uses: softprops/action-gh-release@v1
with:
files: "happy-llm.epub"
tag_name: "latest"
name: "Happy-LLM EPUB (Latest)"
body: |
最新版本的Happy-LLM电子书(主分支自动构建)
包含所有最新章节内容和修正
token: ${{ secrets.GITHUB_TOKEN }}
prerelease: false