Skip to content

Create Images

Create Images #2

Workflow file for this run

name: Create Images
on:
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
workflow_call:
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
typeface: ["Zenbones-Mono", "Zenbones-Slab", "Zenbones-Brainy", "Zenbones-Proto"]
steps:
- name: Set up ImageMagick
run: |
sudo apt-get install imagemagick
export PATH=$PATH:/usr/bin:/usr/local/bin:/usr/local/imagemagick/bin
- name: Download artifacts
id: download_artifacts
uses: dawidd6/action-download-artifact@v6
with:
workflow: merge.yml
workflow_conclusion: success
name: ${{ matrix.typeface }}
path: fonts
- name: Install font
working-directory: fonts
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: |
mkdir images
cd images
convert -size 1200x630 xc:'#f0edec' -gravity north -font ${{ matrix.typeface }} -pointsize 256 -fill '#2c363c' \
-draw "text 0,10 'Aa'" \
-gravity center \
-font ${{ matrix.typeface }} -pointsize 60 -fill '#2c363c' \
-draw ${{ matrix.typeface }} "text 0,40 'ABCDEFGHIJKLMNOPQRSTUVWXYZ 01234'" \
-gravity center \
-font ${{ matrix.typeface }} -pointsize 60 -fill '#2c363c' \
-draw "text 0,120 'abcdefghijklmnopqrstuvwxyz 56789'" \
-gravity center \
-font ${{ matrix.typeface }} -pointsize 60 -fill '#2c363c' \
-draw "text 0,210 '{}[]()<>\`~!@#$%^&*?,.;:\'\"-_+=|\/'" \
${{ 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
working-directory: images
run: |
convert -size 1200x630 xc:'#f0edec' \
-gravity north -font ${{ matrix.typeface }}-Light -pointsize 45 -fill '#2c363c' \
-draw "text 0,20 'A quick brown fox jumps over the lazy dog'" \
-gravity north -font ${{ matrix.typeface }}-Light-Italic -pointsize 45 -fill '#2c363c' \
-draw "text 0,80 'A quick brown fox jumps over the lazy dog'" \
-gravity north -font ${{ matrix.typeface }} -pointsize 45 -fill '#2c363c' \
-draw "text 0,140 'A quick brown fox jumps over the lazy dog'" \
-gravity north -font ${{ matrix.typeface }}-Italic -pointsize 45 -fill '#2c363c' \
-draw "text 0,200 'A quick brown fox jumps over the lazy dog'" \
-gravity north -font ${{ matrix.typeface }}-Medium -pointsize 45 -fill '#2c363c' \
-draw "text 0,260 'A quick brown fox jumps over the lazy dog'" \
-gravity north -font ${{ matrix.typeface }}-Medium-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' \
-draw "text 0,380 'A quick brown fox jumps over the lazy dog'" \
-gravity north -font ${{ matrix.typeface }}-Semibold-Italic -pointsize 45 -fill '#2c363c' \
-draw "text 0,440 'A quick brown fox jumps over the lazy dog'" \
-gravity north -font ${{ matrix.typeface }}-Bold -pointsize 45 -fill '#2c363c' \
-draw "text 0,500 'A quick brown fox jumps over the lazy dog'" \
-gravity north -font ${{ matrix.typeface }}-Bold-Italic -pointsize 45 -fill '#2c363c' \
-draw "text 0,560 'A quick brown fox jumps over the lazy dog'" \
${{ matrix.typeface }}-weights.png
- name: Upload weight images
uses: actions/upload-artifact@v4
with:
name: ${{ matrix.typeface }}-weights
path: images/${{ 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: zenbones-mono/images
merge-multiple: true
- name: Commit and push image changes
working-directory: zenbones-mono
run: |
git add images/*.png
git config --local user.email "hello@michaelchris.space"
git config --local user.name "Michael Chris Lopez"
status=$(git status --porcelain)
if [[ -z "$status" ]]; then
echo "No changes to commit"
exit 0
else
git commit -m "Update images"
git push
fi