woff2 #44
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
name: Release | |
on: | |
push: | |
branches: | |
- main | |
env: | |
FONT_NAME: NeoSpleen | |
jobs: | |
release: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout | |
uses: actions/checkout@v4 | |
- name: FontForge | |
run: sudo apt-get install fontforge libwoff-dev | |
- name: Increment Version | |
id: version | |
run: | | |
OLD_VERSION=$(grep -oP 'Version: "\K[^"]+' ${FONT_NAME}.sfd) | |
MAJOR=$(echo ${OLD_VERSION} | awk -F. '{print $1}') | |
MINOR=$(echo ${OLD_VERSION} | awk -F. '{print $2}') | |
NEW_VERSION="${MAJOR}.${MINOR}.${GITHUB_RUN_NUMBER}" | |
sed -i "s/Version: \"[0-9]\+\.[0-9]\+\.[0-9]\+\"/Version: \"${NEW_VERSION}\"/g" ${FONT_NAME}.sfd | |
sed -i "s/Version +ACIA-[0-9]\+\.[0-9]\+\.[0-9]\+/Version +ACIA-${NEW_VERSION}/g" ${FONT_NAME}.sfd | |
sed -i "s/sfntRevision: 0x000[0-9]*0000/sfntRevision: 0x000${MAJOR}0000/g" ${FONT_NAME}.sfd | |
echo "version=${NEW_VERSION}" >> ${GITHUB_OUTPUT} | |
- name: Generate Font | |
run: | | |
sfd="${FONT_NAME}.sfd" | |
formats=("ttf" "woff2") | |
for format in "${formats[@]}"; do | |
output="${FONT_NAME}.${format}" | |
fontforge -lang=ff -c "Open(\"${sfd}\"); Generate(\"${output}\")" | |
done | |
- name: Generate Nerd Font TTF | |
run: | | |
wget https://github.com/ryanoasis/nerd-fonts/raw/master/FontPatcher.zip | |
unzip FontPatcher.zip -d NerdFontPatcher | |
fontforge -script NerdFontPatcher/font-patcher ${FONT_NAME}.ttf --complete --boxdrawing --no-progressbars --quiet | |
mv ${FONT_NAME}NerdFont-Regular.ttf ${FONT_NAME}-NerdFont.ttf | |
- name: Generate Showcase | |
run: | | |
sudo apt-get install python3 | |
pip3 install Pillow | |
python3 generate_showcase.py | |
- name: Release | |
uses: softprops/action-gh-release@v2 | |
with: | |
files: | | |
*.ttf | |
*.woff2 | |
Showcase-*.png | |
name: ${{ steps.version.outputs.version }} | |
tag_name: ${{ steps.version.outputs.version }} |