Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/main' into review_baking
Browse files Browse the repository at this point in the history
  • Loading branch information
cedounet committed Oct 30, 2023
2 parents e065248 + 2c353c4 commit f191718
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 40 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-book.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/validate-book-build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
23 changes: 12 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -43,20 +43,21 @@ 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/
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/`
Expand All @@ -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)

Expand Down
7 changes: 5 additions & 2 deletions book/makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down
50 changes: 25 additions & 25 deletions makefile
Original file line number Diff line number Diff line change
@@ -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

0 comments on commit f191718

Please sign in to comment.