CI: Automatically deploy webfonts [skip ci]

[why]
The webfonts are needed for the cheat sheet. When we update the sheet
code we probably need also new fonts.
The fonts might contain fixes also if there is no need for a new sheet,
so they have to be updated on every release.

[how]
Add mini-script that generates the woff's from the latest 'ttf'.
This makes it easier to check the woffs manually.

Let the workflow create the woffs, and push them to the gh-pages.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2022-12-16 17:01:54 +01:00
parent 3de381d5ad
commit aef01c4f4f
3 changed files with 32 additions and 1 deletions

View file

@ -310,10 +310,11 @@ jobs:
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
- name: Generate new CSS file
- name: Generate new CSS file and webfonts
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./generate-css.sh
./generate-webfonts.sh
- name: Commit CSS back to repo
uses: EndBug/add-and-commit@v9
@ -347,6 +348,16 @@ jobs:
git-config-email: 41898282+github-actions[bot]@users.noreply.github.com
clean: false
- name: Deploy webfonts to gh-pages
uses: JamesIves/github-pages-deploy-action@v4
with:
folder: webfonts
target-folder: assets/fonts
commit-message: "[ci] Update webfonts"
git-config-name: GitHub Actions
git-config-email: 41898282+github-actions[bot]@users.noreply.github.com
clean: false
- name: Adjust release tag to include previous commit
uses: EndBug/latest-tag@v1.5.0
if: needs.setup-fonts-matrix.outputs.rel_upload == 'true'

View file

@ -15,6 +15,7 @@ Note: Usually you need to call the scripts in this directory while actually bein
* `generate-font-image-previews.sh`: Generates the preview images for `nerdfonts.com` (i.e. gh-pages) [3]
* `generate-glyph-info-from-set.py`: Generate the `i_xxx.sh` file from a glyph source (font) file, if the glyphs are named correctly [4]
* `generate-original-source.py`: Generate `original-source.otf` from single glyph svgs. [5]
* `generate-webfonts.sh`: Generate woff and woff2 font files from the SymbolsOnly font (for the gh-pages) [1]
* `get-font-names-from-json.sh`: Helper to setup the CI font matrix from `data/fonts.json` [1]
* `gotta-patch-em-all-font-patcher!.sh`: Patch one or more fonts 'complete' with and without `mono` and with and without `windows compat` [1]
* `Hack/`: Special additional post patching script for Hack, invoked via Hack's `config.cfg` (not used when self-patching)

View file

@ -0,0 +1,19 @@
#!/usr/bin/env bash
# Nerd Fonts Version: 2.3.0-RC
# Script Version: 1.0.0
# Generates web fonts for the website and cheat sheet
# Destination in the gh-pages branch:
# ./assets/fonts/Symbols-2048-em Nerd Font Complete.woff2
# ./assets/fonts/Symbols-2048-em Nerd Font Complete.woff
font_file="Symbols-2048-em Nerd Font Complete"
patched_dir="../../patched-fonts/NerdFontsSymbolsOnly/complete"
webfontdir="../../webfonts"
if [ ! -d "${webfontdir}" ]; then
mkdir "${webfontdir}"
fi
fontforge -lang=ff -c "Open(\"${patched_dir}/${font_file}.ttf\"); Generate(\"${webfontdir}/${font_file}.woff\")"
fontforge -lang=ff -c "Open(\"${patched_dir}/${font_file}.ttf\"); Generate(\"${webfontdir}/${font_file}.woff2\")"