-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
1 changed file
with
119 additions
and
0 deletions.
There are no files selected for viewing
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,119 @@ | ||
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 "[email protected]" | ||
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 |