diff --git a/.github/workflows/release-book.yml b/.github/workflows/release-book.yml index f10092b8..65738eaf 100644 --- a/.github/workflows/release-book.yml +++ b/.github/workflows/release-book.yml @@ -32,7 +32,7 @@ jobs: options: -v ${{ github.workspace }}:/app run: | cd /app/book - make bake + make -j bake - name: Release baked book to S3 uses: shallwefootball/s3-upload-action@master with: diff --git a/.github/workflows/validate-book-build.yml b/.github/workflows/validate-book-build.yml index 35aafa58..adf48e27 100644 --- a/.github/workflows/validate-book-build.yml +++ b/.github/workflows/validate-book-build.yml @@ -29,4 +29,4 @@ jobs: options: -v ${{ github.workspace }}:/app run: | cd /app/book - make -j build_pdf build_ebook + make -j build_serif_pdf build_ebook diff --git a/README.md b/README.md index 3a4c0dd0..e3b7963f 100644 --- a/README.md +++ b/README.md @@ -33,7 +33,7 @@ make Then you can check out the file `book/book.pdf` If you want to 🍞 bake all the versions including ebook variants (.pdf, .epub -in colour or size optimized Black&White), run: +in colour and size optimized Black&White), run: ```console make bake @@ -43,8 +43,9 @@ You can check the files in the folder `book/release/` ## 🍞 Baking the book locally (LaTeX) -Make sure you have `biber` and `latexmk` installed. Refer to your system's -installation instructions for LaTeX. To create the serif .pdf format, run: +Make sure you have `biber`, `latexmk` and ``ImageMagick`` installed. Refer to +your system's installation instructions for LaTeX. To create the serif .pdf +format, run: ```console cd book/ @@ -52,11 +53,11 @@ make ``` If you want to 🍞 bake all the versions including ebook variants (.pdf, .epub -in colour or size optimized Black&White), run: +in colour and size optimized Black&White), run: ```console cd book/ -make bake +make -j bake ``` You can check the files in the folder `book/release/` @@ -74,16 +75,16 @@ The below versions are automatically built on every push to the `main` branch. * [Download compiled .pdf version](https://www.the-bread-code.io/book.pdf) * [Download compiled .epub version](https://www.the-bread-code.io/book.epub) -There's an additional enhanced accessibility version using a sans serif font: +There's an additional enhanced accessibility version using a sans-serif font: -* [Download compiled .pdf version](https://www.the-bread-code.io/book-sans-serif.pdf) +* [Download compiled sans-serif .pdf version](https://www.the-bread-code.io/book-sans-serif.pdf) -An additional black and white ebook is provided with a greatly reduced file size. This -shrinks the book from more than 50MB down to ~5MB: +An additional black and white ebook is provided with a greatly reduced file +size. This shrinks the book from more than 50MB down to ~5MB: -* [Download compiled .epub version](https://www.the-bread-code.io/bw-book.epub) +* [Download compiled B&W .epub version](https://www.the-bread-code.io/bw-book.epub) -## Online HTML version (WIP) +## Online HTML version Head over to [https://www.the-sourdough-framework.com](https://www.the-sourdough-framework.com) diff --git a/book/makefile b/book/makefile index b08b1fee..7a71ac4a 100644 --- a/book/makefile +++ b/book/makefile @@ -95,15 +95,18 @@ epub/%.epub: %.tex $(src_all) cover/cover-page.xbb bw-book-epub: mkdir -p bw-book-epub +bw-book-epub/OEBPS: bw-book-epub + mkdir -p bw-book-epub/OEBPS + copy_ebook_files: build_ebook | bw-book-epub $(RSYNC) book-epub/ bw-book-epub/ # We not convert SVG to B&W or lower res for now as they are super small # anyway -bw-book-epub/OEBPS/%.jpg: %.jpg +bw-book-epub/OEBPS/%.jpg: %.jpg copy_ebook_files $(CONVERT_PIC) $< $(REDUCE_PIC) $@ -bw-book-epub/OEBPS/%.png: %.png +bw-book-epub/OEBPS/%.png: %.png copy_ebook_files $(CONVERT_PIC) $< $(REDUCE_PIC) $@ epub/bw_book.epub: copy_ebook_files $(bw_images) diff --git a/makefile b/makefile index a52e6e3a..2756c5b0 100644 --- a/makefile +++ b/makefile @@ -1,45 +1,45 @@ -DOCKER_IMAGE := ghcr.io/hendricius/the-sourdough-framework +.DEFAULT_GOAL := build_pdf -.PHONY: build_pdf -build_pdf: mrproper - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make" +DOCKER_IMAGE := ghcr.io/hendricius/the-sourdough-framework +DOCKER_CMD := docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c -.PHONY: bake -bake: mrproper - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make bake" +.PHONY: bake build_pdf build_docker_image push_docker_image validate website +.PHONY: print_os_version start_shell printvars show_tools_version mrproper -.PHONY: build_docker_image +# Dockers targets build_docker_image: docker build -t $(DOCKER_IMAGE) -f Dockerfile --progress=plain . -.PHONY: push_docker_image -push_docker_image: +push_docker_image: build_docker_image docker push $(DOCKER_IMAGE):latest -.PHONY: website -website: mrproper - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make website" +# Books/website + +# Quicker run for each commit, shall catch most problems +validate: + $(DOCKER_CMD) "cd /opt/repo/book && make -j build_serif_pdf build_ebook" + +build_pdf: + $(DOCKER_CMD) "cd /opt/repo/book && make" + +bake: + $(DOCKER_CMD) "cd /opt/repo/book && make -j bake" -.PHONY: validate -validate: mrproper - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make -j build_pdf build_ebook" +website: + $(DOCKER_CMD) "cd /opt/repo/book && make website" -.PHONY: mrproper mrproper: - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make mrproper" + $(DOCKER_CMD) "cd /opt/repo/book && make mrproper" -.PHONY: show_tools_version +# Debug helpers show_tools_version: - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make show_tools_version" + $(DOCKER_CMD) "cd /opt/repo/book && make show_tools_version" -.PHONY: printvars printvars: - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cd /opt/repo/book && make printvars" + $(DOCKER_CMD) "cd /opt/repo/book && make printvars" -.PHONY: print_os_version print_os_version: - docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash -c "cat /etc/*release" + $(DOCKER_CMD) "cat /etc/*release" -.PHONY: start_shell start_shell: docker run -it -v $(PWD):/opt/repo $(DOCKER_IMAGE) /bin/bash