Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Set up GH Actions workflow #106

Merged
merged 4 commits into from
Nov 29, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
94 changes: 94 additions & 0 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,94 @@
name: Build font

on:
push:
branches: [master]
pull_request:
branches: [master]
release:
types:
- created

jobs:
build:
runs-on: ubuntu-latest

steps:

- uses: actions/checkout@v2

- name: Set up Python
uses: actions/setup-python@v2
with:
python-version: "3.10"

- name: gen zip file name
id: zip-name
shell: bash
# Set the archive name to repo name + "-assets" e.g "MavenPro-assets"
run: |
echo "ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-fonts" >> $GITHUB_ENV
echo "FB_REPORTS_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-fontbakery-reports" >> $GITHUB_ENV

- name: Install dependencies
run: |
pip install -r requirements.txt

- name: Build font
run: ./build.sh

- name: Archive font artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.ZIP_NAME }}
path: |
build/fonts

- name: Check with fontbakery
run: ./run_fontbakery.sh
continue-on-error: true

- name: Archive fontbakery artifacts
uses: actions/upload-artifact@v2
with:
name: ${{ env.FB_REPORTS_NAME }}
path: |
build/fontbakery

outputs:
zip_name: ${{ env.ZIP_NAME }}

release:
# only run if the commit is tagged...
if: github.event_name == 'release'
# ... and it builds successfully
needs:
- build

runs-on: ubuntu-latest

env:
ZIP_NAME: ${{ needs.build.outputs.zip_name }}

steps:

- uses: actions/checkout@v2

- name: Download artefact files
uses: actions/download-artifact@v2
with:
name: ${{ env.ZIP_NAME }}
path: ${{ env.ZIP_NAME }}

- name: Zip files
run: zip -r ${{ env.ZIP_NAME }}.zip ${{ env.ZIP_NAME }}

- name: Upload binaries to release
uses: svenstaro/upload-release-action@v2
with:
repo_token: ${{ secrets.GITHUB_TOKEN }}
file: ${{ env.ZIP_NAME }}.zip
asset_name: ${{ env.ZIP_NAME }}.zip
tag: ${{ github.ref }}
overwrite: true
body: "Production ready fonts"
2 changes: 1 addition & 1 deletion requirements.txt
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
fontbakery[googlefonts]==0.10.3
fontbakery[googlefonts]==0.10.4
fontmake==3.6.1
gftools==0.9.38
nanoemoji==0.15.1
Expand Down
8 changes: 7 additions & 1 deletion run_fontbakery.sh
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
#!/bin/sh

set -e # make sure to abort on error
set -x # echo commands

mkdir -p build/fontbakery/

result=0

for folder in Bungee_Basic Bungee_Layers Bungee_Rotated Bungee_Color
do
for ttf in build/fonts/$folder/*.ttf
Expand All @@ -16,5 +17,10 @@ do
-x com.google.fonts/check/vertical_metrics_regressions \
--html build/fontbakery/$(basename $ttf .ttf).html \
$ttf
if [ $? -ne 0 ]; then
result=$((result+1))
fi
done
done

exit $result
Loading