Skip to content

ci(build-font): improve font packaging and release process #3

ci(build-font): improve font packaging and release process

ci(build-font): improve font packaging and release process #3

Workflow file for this run

name: Build and Release Font
on:
push:
branches: ["main"]
paths:
- "private-build-plans.toml"
- ".github/workflows/**"
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
# 1. Checkout your repository to get the config file
- name: Checkout repository
uses: actions/checkout@v4
# 2. Checkout the official Iosevka repository to get the build tools
- name: Checkout Iosevka source
uses: actions/checkout@v4
with:
repository: be5invis/Iosevka
path: iosevka-src
fetch-depth: 1
# 3. Install system dependencies required by Iosevka
- name: Install system dependencies
run: |
sudo apt-get update
sudo apt-get install -y ttfautohint python3
# 4. Set up Node.js, which is required by the Iosevka build scripts
- name: Set up Node.js
uses: actions/setup-node@v4
with:
node-version: "20"
# 5. Copy your custom build plan into the Iosevka source directory
- name: Copy custom build plan
run: cp private-build-plans.toml iosevka-src/
# 6. Install dependencies and build ALL font formats
- name: Install dependencies and build all font formats
run: |
cd iosevka-src
npm install
npm run build -- contents::IoskeleyMono
# 7. Verify build output exists for all formats
- name: Verify build output
run: |
if [ ! -d "iosevka-src/dist/IoskeleyMono/TTF" ] || [ ! -d "iosevka-src/dist/IoskeleyMono/WOFF2" ]; then
echo "Build output directories (TTF and/or WOFF2) not found!"
exit 1
fi
echo "TTF and WOFF2 build directories verified."
# 8. Create separate ZIP archives for Desktop and Web users
- name: Package font files into separate archives
run: |
# Navigate to the output directory to make zipping easier
cd iosevka-src/dist/IoskeleyMono
# Package the Hinted TTF fonts for desktop
zip -r ../../IoskeleyMono-TTF-Hinted.zip TTF
# Package the Unhinted TTF fonts for desktop
zip -r ../../IoskeleyMono-TTF-Unhinted.zip TTF-Unhinted
# Package all WOFF2 fonts for web use
zip -r ../../IoskeleyMono-Web.zip WOFF2 WOFF2-Unhinted
# 9. Set the release version number
- name: Set Release Version
id: vars
run: echo "tag=$(date +'%Y.%m.%d')-${{ github.run_number }}" >> $GITHUB_OUTPUT
# 10. Create a new GitHub Release and upload all three ZIP files
- name: Create Release and Upload Assets
uses: softprops/action-gh-release@v1
with:
tag_name: ${{ steps.vars.outputs.tag }}
name: "Release ${{ steps.vars.outputs.tag }}"
body: |
Automated build triggered by commit ${{ github.sha }}.
**For Desktop Users:**
- `IoskeleyMono-TTF-Hinted.zip`: Fonts with hinting. Best for most users on standard-resolution screens.
- `IoskeleyMono-TTF-Unhinted.zip`: Raw fonts without hinting. Preferred by some on high-DPI screens.
**For Web Developers:**
- `IoskeleyMono-Web.zip`: Contains all WOFF2 font files for web use.
files: |
IoskeleyMono-TTF-Hinted.zip
IoskeleyMono-TTF-Unhinted.zip
IoskeleyMono-Web.zip
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}