Create Images #14
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Images | |
on: | |
# Allows you to run this workflow manually from the Actions tab | |
workflow_dispatch: | |
workflow_call: | |
permissions: | |
contents: write | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
typeface: ["Zenbones-Mono", "Zenbones-Slab", "Zenbones-Brainy", "Zenbones-Proto"] | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Set up ImageMagick | |
run: | | |
sudo apt-get install imagemagick | |
export PATH=$PATH:/usr/bin:/usr/local/bin:/usr/local/imagemagick/bin | |
- name: Download release file | |
env: | |
GH_TOKEN: ${{ secrets.GITHUB_TOKEN }} | |
run: gh release download --pattern ${{ matrix.typeface }}.tar.gz | |
- name: Install font | |
run: | | |
tar xzf ${{ matrix.typeface }}.tar.gz | |
sudo cp ${{ matrix.typeface }}/TTF/*.ttf /usr/local/share/fonts | |
sudo fc-cache -f -v | |
- name: Generate specimen image | |
run: | | |
rm -rf images | |
mkdir images | |
cd images | |
convert -size 1200x630 xc:'#f0edec' -gravity north -font ${{ matrix.typeface }} -pointsize 128 -fill '#2c363c' \ | |
-draw "text 0,10 'Aa'" \ | |
-gravity center \ | |
-font ${{ matrix.typeface }} -pointsize 40 -fill '#2c363c' \ | |
-draw "text 0,30 'ABC.DEF.GHI.JKL.MNO.PQRS.TUV.WXYZ abc.def.ghi.jkl.mno.pqrs.tuv.wxyz'" \ | |
-gravity center \ | |
-font ${{ matrix.typeface }} -pointsize 40 -fill '#2c363c' \ | |
-draw "text 0,90 '!iIlL17|¦ ¢coO08BbDQ $5SZ2zs 96µm float il1[]={1-2/3.4,5+6=7/8%90};'" \ | |
-gravity center \ | |
-font ${{ matrix.typeface }} -pointsize 40 -fill '#2c363c' \ | |
-draw "text 0,150 '1234567890 ,._-+= >< «¯-¬_» ~–÷+× {*}[]()<>\`+-=$/#_%^@\&|~?\'\" !,.;:'" \ | |
-font ${{ matrix.typeface }} -pointsize 40 -fill '#2c363c' \ | |
-draw "text 0,210 'CG6Qg9q¶ Þẞðþſß ΓΔΛαβγδιλμνξπτυχ∂ ЖЗКНРУЭЯавжзклмнруфчьыэя <= != =='" \ | |
${{ matrix.typeface }}-specimen.png | |
- name: Upload specimen images | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.typeface }}-specimen | |
path: images/${{ matrix.typeface }}-specimen.png | |
- name: Generate weights image | |
run: | | |
convert -size 1200x390 xc:'#f0edec' \ | |
-gravity north -font ${{ matrix.typeface }} -pointsize 45 -fill '#2c363c' \ | |
-draw "text 0,20 'A quick brown fox jumps over the lazy dog'" \ | |
-gravity north -font ${{ matrix.typeface }}-Italic -pointsize 45 -fill '#2c363c' \ | |
-draw "text 0,80 'A quick brown fox jumps over the lazy dog'" \ | |
-gravity north -font ${{ matrix.typeface }}-Semibold -pointsize 45 -fill '#2c363c' \ | |
-draw "text 0,140 'A quick brown fox jumps over the lazy dog'" \ | |
-gravity north -font ${{ matrix.typeface }}-Semibold-Italic -pointsize 45 -fill '#2c363c' \ | |
-draw "text 0,200 'A quick brown fox jumps over the lazy dog'" \ | |
-gravity north -font ${{ matrix.typeface }}-Bold -pointsize 45 -fill '#2c363c' \ | |
-draw "text 0,260 'A quick brown fox jumps over the lazy dog'" \ | |
-gravity north -font ${{ matrix.typeface }}-Bold-Italic -pointsize 45 -fill '#2c363c' \ | |
-draw "text 0,320 'A quick brown fox jumps over the lazy dog'" \ | |
-gravity north -font ${{ matrix.typeface }}-Semibold -pointsize 45 -fill '#2c363c' \ | |
${{ matrix.typeface }}-weights.png | |
- name: Upload weight images | |
uses: actions/upload-artifact@v4 | |
with: | |
name: ${{ matrix.typeface }}-weights | |
path: ${{ matrix.typeface }}-weights.png | |
commit: | |
needs: build | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v4 | |
- name: Download all workflow run artifacts | |
uses: actions/download-artifact@v4 | |
with: | |
path: images | |
merge-multiple: true | |
- name: Push changes | |
uses: stefanzweifel/git-auto-commit-action@v5 | |
with: | |
branch: main | |
commit_message: "chore(build): update images" | |
commit_user_name: "github-actions[bot]" | |
commit_user_email: "github-actions[bot]@users.noreply.github.com" | |
commit_author: "github-actions[bot] <github-actions[bot]@users.noreply.github.com>" |