Skip to content

Commit bfb63af

Browse files
committed
ci: automate GitBook build and publish on markdown changes
1 parent 1a9f163 commit bfb63af

File tree

10 files changed

+233
-40
lines changed

10 files changed

+233
-40
lines changed
Lines changed: 57 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,57 @@
1+
name: Build GitBook
2+
3+
on:
4+
push:
5+
branches:
6+
- master
7+
paths:
8+
- '**/*.md'
9+
- 'book.json'
10+
- 'SUMMARY.md'
11+
- 'package.json'
12+
- 'package-lock.json'
13+
workflow_dispatch:
14+
15+
permissions:
16+
contents: write
17+
18+
jobs:
19+
build-and-commit:
20+
if: github.actor != 'github-actions[bot]'
21+
runs-on: ubuntu-latest
22+
23+
steps:
24+
- name: Checkout
25+
uses: actions/checkout@v4
26+
with:
27+
fetch-depth: 0
28+
29+
- name: Setup Node.js
30+
uses: actions/setup-node@v4
31+
with:
32+
node-version: '16'
33+
34+
- name: Install dependencies and GitBook plugins
35+
run: |
36+
npm install
37+
npm install -g gitbook-cli
38+
gitbook install
39+
40+
- name: Build GitBook
41+
run: |
42+
gitbook build
43+
cp -R _book/* .
44+
git clean -fx _book
45+
46+
- name: Commit generated site files
47+
run: |
48+
git config user.name "github-actions[bot]"
49+
git config user.email "41898282+github-actions[bot]@users.noreply.github.com"
50+
51+
if [ -n "$(git status --porcelain)" ]; then
52+
git add -A
53+
git commit -m "chore: regenerate GitBook output"
54+
git push
55+
else
56+
echo "No generated changes to commit"
57+
fi

command_line/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ <h1 class="search-results-title">No results matching "<span class='search-query'
321321
<script>
322322
var gitbook = gitbook || [];
323323
gitbook.push(function() {
324-
gitbook.page.hasChanged({"page":{"title":"Command Line","level":"2.1","depth":1,"next":{"title":"Introduction Flashcards","level":"2.1.1","depth":2,"path":"command_line/introduction.md","ref":"command_line/introduction.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","advanced-emoji","prism","highlight","copy-code-button","edit-link","github","github-buttons","ga","fontsettings"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/flashcards/flashcards.github.io/"},"search":{},"lunr":{"maxIndexSize":1000000},"fontsettings":{"family":"sans","size":2,"theme":"white"},"highlight":{},"github-buttons":{"buttons":[{"user":"flashcards","repo":"flashcards.github.io","type":"star","size":"small","count":true},{"user":"flashcards","repo":"flashcards.github.io","type":"watch","size":"small"}]},"copy-code-button":{},"ga":{"configuration":"auto","token":"UA-129080735-2"},"advanced-emoji":{"embedEmojis":false},"include-codeblock":{"check":false,"edit":false,"fixlang":false,"lang":"","template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit This Page","base":"https://github.com/flashcards/flashcards.github.io/edit/master"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Flashcards for Developers | flashcards.github.io","gitbook":"3.1.1"},"file":{"path":"command_line/README.md","mtime":"2023-12-10T04:15:55.995Z","type":"markdown"},"gitbook":{"version":"3.1.1","time":"2024-02-17T17:28:19.444Z"},"basePath":"..","book":{"language":""}});
324+
gitbook.page.hasChanged({"page":{"title":"Command Line","level":"2.1","depth":1,"next":{"title":"Introduction Flashcards","level":"2.1.1","depth":2,"path":"command_line/introduction.md","ref":"command_line/introduction.md","articles":[]},"previous":{"title":"Introduction","level":"1.1","depth":1,"path":"README.md","ref":"README.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","advanced-emoji","prism","highlight","copy-code-button","edit-link","github","github-buttons","ga","fontsettings"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/flashcards/flashcards.github.io/"},"search":{},"lunr":{"maxIndexSize":1000000},"fontsettings":{"family":"sans","size":2,"theme":"white"},"highlight":{},"github-buttons":{"buttons":[{"user":"flashcards","repo":"flashcards.github.io","type":"star","size":"small","count":true},{"user":"flashcards","repo":"flashcards.github.io","type":"watch","size":"small"}]},"copy-code-button":{},"ga":{"configuration":"auto","token":"UA-129080735-2"},"advanced-emoji":{"embedEmojis":false},"include-codeblock":{"check":false,"edit":false,"fixlang":false,"lang":"","template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit This Page","base":"https://github.com/flashcards/flashcards.github.io/edit/master"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Flashcards for Developers | flashcards.github.io","gitbook":"3.1.1"},"file":{"path":"command_line/README.md","mtime":"2023-12-10T04:15:55.995Z","type":"markdown"},"gitbook":{"version":"3.1.1","time":"2026-02-15T20:16:45.744Z"},"basePath":"..","book":{"language":""}});
325325
});
326326
</script>
327327
</div>

command_line/introduction.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -361,7 +361,7 @@ <h1 class="search-results-title">No results matching "<span class='search-query'
361361
<script>
362362
var gitbook = gitbook || [];
363363
gitbook.push(function() {
364-
gitbook.page.hasChanged({"page":{"title":"Introduction Flashcards","level":"2.1.1","depth":2,"next":{"title":"GraphQL","level":"2.2","depth":1,"path":"graphql/README.md","ref":"graphql/README.md","articles":[{"title":"Introduction Flashcards","level":"2.2.1","depth":2,"path":"graphql/introduction.md","ref":"graphql/introduction.md","articles":[]}]},"previous":{"title":"Command Line","level":"2.1","depth":1,"path":"command_line/README.md","ref":"command_line/README.md","articles":[{"title":"Introduction Flashcards","level":"2.1.1","depth":2,"path":"command_line/introduction.md","ref":"command_line/introduction.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["include-codeblock","advanced-emoji","prism","highlight","copy-code-button","edit-link","github","github-buttons","ga","fontsettings"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/flashcards/flashcards.github.io/"},"search":{},"lunr":{"maxIndexSize":1000000},"fontsettings":{"family":"sans","size":2,"theme":"white"},"highlight":{},"github-buttons":{"buttons":[{"user":"flashcards","repo":"flashcards.github.io","type":"star","size":"small","count":true},{"user":"flashcards","repo":"flashcards.github.io","type":"watch","size":"small"}]},"copy-code-button":{},"ga":{"configuration":"auto","token":"UA-129080735-2"},"advanced-emoji":{"embedEmojis":false},"include-codeblock":{"check":false,"edit":false,"fixlang":false,"lang":"","template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit This Page","base":"https://github.com/flashcards/flashcards.github.io/edit/master"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Flashcards for Developers | flashcards.github.io","gitbook":"3.1.1"},"file":{"path":"command_line/introduction.md","mtime":"2024-02-17T17:24:29.809Z","type":"markdown"},"gitbook":{"version":"3.1.1","time":"2024-02-17T17:28:19.444Z"},"basePath":"..","book":{"language":""}});
364+
gitbook.page.hasChanged({"page":{"title":"Introduction Flashcards","level":"2.1.1","depth":2,"next":{"title":"GraphQL","level":"2.2","depth":1,"path":"graphql/README.md","ref":"graphql/README.md","articles":[{"title":"Introduction Flashcards","level":"2.2.1","depth":2,"path":"graphql/introduction.md","ref":"graphql/introduction.md","articles":[]}]},"previous":{"title":"Command Line","level":"2.1","depth":1,"path":"command_line/README.md","ref":"command_line/README.md","articles":[{"title":"Introduction Flashcards","level":"2.1.1","depth":2,"path":"command_line/introduction.md","ref":"command_line/introduction.md","articles":[]}]},"dir":"ltr"},"config":{"plugins":["include-codeblock","advanced-emoji","prism","highlight","copy-code-button","edit-link","github","github-buttons","ga","fontsettings"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/flashcards/flashcards.github.io/"},"search":{},"lunr":{"maxIndexSize":1000000},"fontsettings":{"family":"sans","size":2,"theme":"white"},"highlight":{},"github-buttons":{"buttons":[{"user":"flashcards","repo":"flashcards.github.io","type":"star","size":"small","count":true},{"user":"flashcards","repo":"flashcards.github.io","type":"watch","size":"small"}]},"copy-code-button":{},"ga":{"configuration":"auto","token":"UA-129080735-2"},"advanced-emoji":{"embedEmojis":false},"include-codeblock":{"check":false,"edit":false,"fixlang":false,"lang":"","template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit This Page","base":"https://github.com/flashcards/flashcards.github.io/edit/master"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Flashcards for Developers | flashcards.github.io","gitbook":"3.1.1"},"file":{"path":"command_line/introduction.md","mtime":"2024-08-10T20:22:24.490Z","type":"markdown"},"gitbook":{"version":"3.1.1","time":"2026-02-15T20:16:45.744Z"},"basePath":"..","book":{"language":""}});
365365
});
366366
</script>
367367
</div>

graphql/index.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -321,7 +321,7 @@ <h1 class="search-results-title">No results matching "<span class='search-query'
321321
<script>
322322
var gitbook = gitbook || [];
323323
gitbook.push(function() {
324-
gitbook.page.hasChanged({"page":{"title":"GraphQL","level":"2.2","depth":1,"next":{"title":"Introduction Flashcards","level":"2.2.1","depth":2,"path":"graphql/introduction.md","ref":"graphql/introduction.md","articles":[]},"previous":{"title":"Introduction Flashcards","level":"2.1.1","depth":2,"path":"command_line/introduction.md","ref":"command_line/introduction.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","advanced-emoji","prism","highlight","copy-code-button","edit-link","github","github-buttons","ga","fontsettings"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/flashcards/flashcards.github.io/"},"search":{},"lunr":{"maxIndexSize":1000000},"fontsettings":{"family":"sans","size":2,"theme":"white"},"highlight":{},"github-buttons":{"buttons":[{"user":"flashcards","repo":"flashcards.github.io","type":"star","size":"small","count":true},{"user":"flashcards","repo":"flashcards.github.io","type":"watch","size":"small"}]},"copy-code-button":{},"ga":{"configuration":"auto","token":"UA-129080735-2"},"advanced-emoji":{"embedEmojis":false},"include-codeblock":{"check":false,"edit":false,"fixlang":false,"lang":"","template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit This Page","base":"https://github.com/flashcards/flashcards.github.io/edit/master"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Flashcards for Developers | flashcards.github.io","gitbook":"3.1.1"},"file":{"path":"graphql/README.md","mtime":"2023-12-10T04:15:56.103Z","type":"markdown"},"gitbook":{"version":"3.1.1","time":"2024-02-17T17:28:19.444Z"},"basePath":"..","book":{"language":""}});
324+
gitbook.page.hasChanged({"page":{"title":"GraphQL","level":"2.2","depth":1,"next":{"title":"Introduction Flashcards","level":"2.2.1","depth":2,"path":"graphql/introduction.md","ref":"graphql/introduction.md","articles":[]},"previous":{"title":"Introduction Flashcards","level":"2.1.1","depth":2,"path":"command_line/introduction.md","ref":"command_line/introduction.md","articles":[]},"dir":"ltr"},"config":{"plugins":["include-codeblock","advanced-emoji","prism","highlight","copy-code-button","edit-link","github","github-buttons","ga","fontsettings"],"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"pluginsConfig":{"prism":{},"github":{"url":"https://github.com/flashcards/flashcards.github.io/"},"search":{},"lunr":{"maxIndexSize":1000000},"fontsettings":{"family":"sans","size":2,"theme":"white"},"highlight":{},"github-buttons":{"buttons":[{"user":"flashcards","repo":"flashcards.github.io","type":"star","size":"small","count":true},{"user":"flashcards","repo":"flashcards.github.io","type":"watch","size":"small"}]},"copy-code-button":{},"ga":{"configuration":"auto","token":"UA-129080735-2"},"advanced-emoji":{"embedEmojis":false},"include-codeblock":{"check":false,"edit":false,"fixlang":false,"lang":"","template":"default","theme":"chrome","unindent":false},"sharing":{"facebook":true,"twitter":true,"google":false,"weibo":false,"instapaper":false,"vk":false,"all":["facebook","google","twitter","weibo","instapaper"]},"edit-link":{"label":"Edit This Page","base":"https://github.com/flashcards/flashcards.github.io/edit/master"},"theme-default":{"styles":{"website":"styles/website.css","pdf":"styles/pdf.css","epub":"styles/epub.css","mobi":"styles/mobi.css","ebook":"styles/ebook.css","print":"styles/print.css"},"showLevel":false}},"theme":"default","pdf":{"pageNumbers":true,"fontSize":12,"fontFamily":"Arial","paperSize":"a4","chapterMark":"pagebreak","pageBreaksBefore":"/","margin":{"right":62,"left":62,"top":56,"bottom":56}},"structure":{"langs":"LANGS.md","readme":"README.md","glossary":"GLOSSARY.md","summary":"SUMMARY.md"},"variables":{},"title":"Flashcards for Developers | flashcards.github.io","gitbook":"3.1.1"},"file":{"path":"graphql/README.md","mtime":"2023-12-10T04:15:56.103Z","type":"markdown"},"gitbook":{"version":"3.1.1","time":"2026-02-15T20:16:45.744Z"},"basePath":"..","book":{"language":""}});
325325
});
326326
</script>
327327
</div>

0 commit comments

Comments
 (0)