Skip to content
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
192 changes: 192 additions & 0 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,192 @@
name: Build font and specimen

on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- master # for backwards compatibility; use your default branch if different
tags:
- "*"

permissions: write-all

jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.11
uses: actions/setup-python@v6
id: python
with:
python-version: "3.11"
- name: Setup fontspector
uses: fonttools/setup-fontspector@main
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- uses: cargo-bins/cargo-binstall@main
name: Install cargo binstall
- name: Install Rust font tools
run: |
cargo binstall --no-confirm diffenator3
# gftools-builder3 builds with fontc. Prefer the org-shared prebuilt binary
# published by the gftools-builder3 repo; fall back to compiling it (cached)
# if that release is not available.
- name: Download prebuilt gftools-builder3
id: prebuilt
continue-on-error: true
run: |
mkdir -p "$HOME/.cargo/bin"
curl -fsSL https://github.com/simoncozens/gftools-builder3/releases/download/main-latest/gftools-builder-x86_64-linux -o "$HOME/.cargo/bin/gftools-builder"
chmod +x "$HOME/.cargo/bin/gftools-builder"
"$HOME/.cargo/bin/gftools-builder" --version
- name: Resolve gftools-builder3 revision
if: steps.prebuilt.outcome != 'success'
id: builder3-rev
run: echo "sha=$(git ls-remote https://github.com/simoncozens/gftools-builder3 refs/heads/main | cut -f1)" >> "$GITHUB_OUTPUT"
- name: Restore cached gftools-builder3 binary
if: steps.prebuilt.outcome != 'success'
id: cache-builder3
uses: actions/cache/restore@v5
with:
path: ~/.cargo/bin/gftools-builder
key: gftools-builder3-${{ runner.os }}-${{ steps.builder3-rev.outputs.sha }}
- name: Cache cargo downloads (fontc, babelfont-rs, deps)
if: steps.prebuilt.outcome != 'success' && steps.cache-builder3.outputs.cache-hit != 'true'
uses: actions/cache@v5
with:
path: |
~/.cargo/registry/index
~/.cargo/registry/cache
~/.cargo/git/db
key: cargo-deps-${{ runner.os }}-${{ steps.builder3-rev.outputs.sha }}
restore-keys: |
cargo-deps-${{ runner.os }}-
- name: Compile gftools-builder3 (fallback)
if: steps.prebuilt.outcome != 'success' && steps.cache-builder3.outputs.cache-hit != 'true'
run: |
cargo install --git https://github.com/simoncozens/gftools-builder3 --branch main --locked gftools-builder
- name: Save gftools-builder3 binary to cache
if: steps.prebuilt.outcome != 'success' && steps.cache-builder3.outputs.cache-hit != 'true'
uses: actions/cache/save@v5
with:
path: ~/.cargo/bin/gftools-builder
key: gftools-builder3-${{ runner.os }}-${{ steps.builder3-rev.outputs.sha }}
- name: Install toolset
run: |
sudo apt-get update
sudo apt-get install ttfautohint libcairo2-dev python3-cairo-dev pkg-config python3-dev
sudo snap install yq
- uses: actions/cache@v5
with:
path: ./venv/
key: ${{ runner.os }}-venv${{ steps.python.outputs.python-version }}-${{ hashFiles('**/requirements*.txt') }}
restore-keys: |
${{ runner.os }}-venv${{ steps.python.outputs.python-version }}-
- name: Set artifact file name
id: zip-name
shell: bash
# Set the archive name to repo name + "-fonts" e.g "radiocanadafonts-fonts.zip"
run: echo "ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-fonts" >> $GITHUB_ENV

# If a new release is cut, use the release tag to auto-bump the source files
# - name: Bump release
# if: github.event_name == 'release'
# run: |
# . venv/bin/activate
# SRCS=$(yq e ".sources[]" sources/config.yaml)
# TAG_NAME=${GITHUB_REF/refs\/tags\//}
# echo "Bumping $SRCS to $TAG_NAME"
# for src in $SRCS
# do
# bumpfontversion sources/$src --new-version $TAG_NAME;
# done

- name: Build font
run: make build
- name: Check with fontspector
run: make test
continue-on-error: true
- name: Generate proofs
run: make proof
- name: Set up test result site
run: cp scripts/index.html out/index.html
- name: Collect deployment assets
if: ${{ github.ref_name == github.event.repository.default_branch }}
uses: actions/upload-pages-artifact@v5
with:
path: ./out
- name: Archive artifacts
uses: actions/upload-artifact@v6
with:
name: ${{ env.ZIP_NAME }}
path: |
fonts
out
outputs:
zip_name: ${{ env.ZIP_NAME }}

deploy:
name: Deploy results to GitHub Pages
if: ${{ github.ref_name == github.event.repository.default_branch }}
needs: build
runs-on: ubuntu-latest
permissions:
pages: write
id-token: write
environment:
name: github-pages
url: ${{ steps.deployment.outputs.page_url }}
steps:
- name: Deploy to GitHub Pages
id: deployment
uses: actions/deploy-pages@v5

# There are two ways a release can be created: either by pushing a tag, or by
# creating a release from the GitHub UI. Pushing a tag does not automatically
# create a release, so we have to do that ourselves. However, creating a
# release from the GitHub UI *does* push a tag, and we don't want to create
# a new release in that case because one already exists!

release:
name: Release bundle
if: ${{ github.ref_type == 'tag' }}
needs: build
runs-on: ubuntu-latest
env:
ZIP_NAME: ${{ needs.build.outputs.zip_name }}
GH_TOKEN: ${{ github.token }}
steps:
- uses: actions/checkout@v6
- name: Use font artifacts from CI
uses: actions/download-artifact@v7
with:
name: ${{ env.ZIP_NAME }}
path: ${{ env.ZIP_NAME }}
- name: Copy ARTICLE.en_us.html to release directory
run: cp documentation/ARTICLE.en_us.html ${{ env.ZIP_NAME }}/ARTICLE.en_us.html
continue-on-error: true
- name: Copy OFL.txt to release directory
run: cp OFL.txt ${{ env.ZIP_NAME }}/OFL.txt
- name: Remove proof/test outputs from release
run: rm -rf ${{ env.ZIP_NAME }}/out
- name: Set release file name
shell: bash
run: echo "RELEASE_ZIP_NAME=$(echo '${{ github.repository }}' | awk -F '/' '{print $2}')-${{github.ref_name}}" >> $GITHUB_ENV
- name: Create release bundle
run: mv ${{ env.ZIP_NAME }} ${{ env.RELEASE_ZIP_NAME }}; zip -r ${{ env.RELEASE_ZIP_NAME }}.zip ${{ env.RELEASE_ZIP_NAME }}
- name: Check for release
id: create_release
run: |
if ! gh release view ${{ github.ref_name }}; then
git show -s --format=%B ${{ github.ref_name }} | tail -n +4 | gh release create ${{ github.ref_name }} -t ${{ github.ref_name }} -F -
fi
- name: Populate release
run: |
gh release upload ${{ github.ref_name }} ${{ env.RELEASE_ZIP_NAME }}.zip --clobber
- name: Set release live
run: |
gh release edit ${{ github.ref_name }} --draft=false
26 changes: 0 additions & 26 deletions .travis.yml

This file was deleted.

9 changes: 0 additions & 9 deletions Inika-Bold.ttf.D_S_I_G_.ttx

This file was deleted.

11 changes: 0 additions & 11 deletions Inika-Bold.ttf.F_F_T_M_.ttx

This file was deleted.

Loading
Loading