diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index a3b929641..0210c2fa8 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -21,13 +21,8 @@ jobs: run: | rm -f README.md mv content/* . - mv etc/cover_small.jpg . - mv etc/cover_square.png . - mv etc/cover.jpg . - mv etc/style-custom.css . + mv book.json etc/ mv etc/main.go . - mv etc/robots.txt . - mv etc/script-gitbook-plugin-disqus.js . npm install -g gitbook-cli gitbook install cd ~/.gitbook/versions/3.2.3 && npm i npm@5 @@ -73,12 +68,13 @@ jobs: run: | rm -f README.md mv content/* . - mv etc/cover_small.jpg . - mv etc/cover_square.png . - mv etc/cover.jpg . mv etc/main.go . - go run main.go -mode=ebook -adjustment=pre + rm -f book.json gitbook install + cd ~/.gitbook/versions/3.2.3 && npm i npm@5 + cd ${{ github.workspace }} + mv etc/book.json . + go run main.go -mode=ebook -adjustment=pre mkdir _book/ - name: 'Generating ebook in pdf' run: gitbook pdf ./ ./_book/dasarpemrogramangolang.pdf diff --git a/etc/book.json b/content/book.json similarity index 86% rename from etc/book.json rename to content/book.json index dfc2a902a..e19acef6c 100644 --- a/etc/book.json +++ b/content/book.json @@ -7,6 +7,15 @@ "meta", "sitemap" ], + "styles": { + "website": "style-website.css" + }, + "pdf": { + "margin": { + "left": 10, + "right": 10 + } + }, "pluginsConfig": { "disqus": { "shortName": "dasarpemrogramangolang" diff --git a/etc/cover.jpg b/content/cover.jpg similarity index 100% rename from etc/cover.jpg rename to content/cover.jpg diff --git a/etc/cover_small.jpg b/content/cover_small.jpg similarity index 100% rename from etc/cover_small.jpg rename to content/cover_small.jpg diff --git a/etc/cover_square.png b/content/cover_square.png similarity index 100% rename from etc/cover_square.png rename to content/cover_square.png diff --git a/etc/robots.txt b/content/robots.txt similarity index 100% rename from etc/robots.txt rename to content/robots.txt diff --git a/etc/script-gitbook-plugin-disqus.js b/content/script-gitbook-plugin-disqus.js similarity index 100% rename from etc/script-gitbook-plugin-disqus.js rename to content/script-gitbook-plugin-disqus.js diff --git a/etc/style-custom.css b/content/style-website.css similarity index 100% rename from etc/style-custom.css rename to content/style-website.css diff --git a/etc/main.go b/etc/main.go index 7198e1662..ba73a6d74 100644 --- a/etc/main.go +++ b/etc/main.go @@ -178,13 +178,6 @@ func webbookPostAdjustment() { ` + buttonToFind htmlString = strings.ReplaceAll(htmlString, buttonToFind, buttonReplacement) - // ==== inject adjustment css - adjustmentCSSBuf, _ := os.ReadFile("./style-custom.css") - os.WriteFile("./_book/gitbook/style-custom.css", adjustmentCSSBuf, 0644) - adjustmentCSSToFind := `` - adjustmentCSSReplacement := `` + adjustmentCSSToFind - htmlString = strings.ReplaceAll(htmlString, adjustmentCSSToFind, adjustmentCSSReplacement) - // ==== inject github stars js script buttonScriptToFind := `` buttonScriptReplacement := `` + buttonScriptToFind