Skip to content

Commit d428e21

Browse files
committed
feat: add Generate GitBook eBooks action
1 parent aeba7e6 commit d428e21

File tree

2 files changed

+42
-1
lines changed

2 files changed

+42
-1
lines changed

.github/workflows/ebooks.yaml

Lines changed: 41 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,41 @@
1+
name: Generate GitBook eBooks
2+
3+
on:
4+
push:
5+
branches:
6+
- main
7+
workflow_dispatch:
8+
9+
jobs:
10+
build-ebook:
11+
runs-on: ubuntu-latest
12+
13+
steps:
14+
- name: Checkout repository
15+
uses: actions/checkout@v3
16+
17+
- name: Set up Pandoc
18+
uses: siacodelabs/setup-pandoc@v1
19+
with:
20+
xelatex: true
21+
22+
- name: Generate EPUB file
23+
run: make epub
24+
25+
- name: Create or update Release and upload EPUB
26+
if: github.ref == 'main' && github.event_name == 'push'
27+
uses: ncipollo/release-action@v1
28+
with:
29+
tag: latest
30+
name: DDIA EBook - Latest Release
31+
artifacts: output/ddia.epub
32+
allowUpdates: true
33+
env:
34+
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
35+
36+
- name: Upload generated eBooks
37+
if: github.event_name == 'workflow_dispatch'
38+
uses: actions/upload-artifact@v4
39+
with:
40+
name: ebooks
41+
path: output/ddia.epub

bin/epub

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ convert_to_epub() {
2020
pandoc -o "$OUTPUT_BOOK" --metadata-file="$meta_file" \
2121
--toc-depth=2 \
2222
--top-level-division=chapter \
23-
--file-scope=true \
23+
--file-scope \
2424
--css="$css_file" \
2525
--webtex \
2626
--wrap=preserve \

0 commit comments

Comments
 (0)