Skip to content

Phase 3: publish per channel to GitHub Releases #13

Phase 3: publish per channel to GitHub Releases

Phase 3: publish per channel to GitHub Releases #13

Workflow file for this run

name: Build font and specimen
on:
workflow_dispatch:
pull_request:
push:
branches:
- main
- master # for backwards compatibility; use your default branch if different
- dev
tags:
- "*"
permissions: write-all
jobs:
build:
name: Build and test
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v6
- name: Set up Python 3.12
uses: actions/setup-python@v6
id: python
with:
python-version: "3.12"
- 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 --disable-strategies compile diffenator3
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
- name: Install toolset
run: |
sudo apt-get update
sudo apt-get install ttfautohint libcairo2-dev python3-cairo-dev pkg-config python3-dev
# yq (mikefarah) is preinstalled on GitHub-hosted ubuntu runners; snap is flaky, so avoid it
- 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: Stamp version (OpenFV name table)
run: make stamp
- name: Check with fontspector
run: make test
continue-on-error: true
- name: Generate proofs
run: make proof
- name: Emit build manifest (fontstatus.json)
run: make manifest
- 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 && github.event.repository.private == false }}
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
- name: Set short SHA
if: ${{ github.ref_name == 'dev' && github.event_name == 'push' }}
shell: bash
run: echo "SHORT_SHA=${GITHUB_SHA::7}" >> $GITHUB_ENV
- name: Archive dev-channel fonts for FontPipe
if: ${{ github.ref_name == 'dev' && github.event_name == 'push' }}
uses: actions/upload-artifact@v6
with:
name: dev-fonts-${{ env.SHORT_SHA }}
path: fonts/**/*.ttf
retention-days: 30
- name: Publish channel (canary / dev / release)
# canary = push to dev; dev = a *-dev.N tag; release = any other tag.
if: ${{ (github.ref_name == 'dev' && github.event_name == 'push') || github.ref_type == 'tag' }}
env:
GH_TOKEN: ${{ github.token }}
run: |
if [ "$GITHUB_REF_TYPE" = "tag" ]; then
case "$GITHUB_REF_NAME" in *-dev.*|*-dev) CH=dev ;; *) CH=release ;; esac
else CH=canary; fi
bash scripts/publish_channel.sh "$CH"
outputs:
zip_name: ${{ env.ZIP_NAME }}
deploy:
name: Deploy results to GitHub Pages
if: ${{ github.ref_name == github.event.repository.default_branch && github.event.repository.private == false }}
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
# Publishing (canary / dev / release) is handled by the "Publish channel" step in the
# build job (scripts/publish_channel.sh) — the build job already has the built fonts +
# fontstatus.json in hand, so no separate release job / artifact round-trip is needed.
# canary → rolling `canary` pre-release; dev → `vX.YYY-dev.N` pre-release; release →
# `vX.YYY` Release. See docs/channels-and-versioning.md + docs/fontpipe-migration-brief.md.