Patch WenKai Fonts #38
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: Patch WenKai Fonts | |
on: | |
schedule: | |
- cron: '0 0 * * *' # Daily scheduled check, adjust as needed | |
workflow_dispatch: # Manually trigger the workflow | |
jobs: | |
check-and-patch: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout repository code | |
uses: actions/checkout@v3 | |
- name: Get latest version | |
id: fetch-release | |
run: | | |
LATEST_RELEASE=$(curl -s https://api.github.com/repos/lxgw/LxgwWenKai/releases/latest | jq -r .tag_name) | |
echo "LATEST_RELEASE=$LATEST_RELEASE" >> $GITHUB_ENV | |
if git tag | grep -q "$LATEST_RELEASE"; then | |
echo "Version $LATEST_RELEASE has already been processed." | |
exit 0 | |
fi | |
- name: Install dependencies | |
run: | | |
sudo apt-get update | |
sudo apt-get install -y fontforge python3 python3-pip python3-fontforge tree | |
- name: Download fonts and show structure | |
run: | | |
mkdir fonts | |
wget -q -O fonts/lxgw-wenkai.tar.gz https://github.com/lxgw/LxgwWenKai/releases/download/$LATEST_RELEASE/lxgw-wenkai-$LATEST_RELEASE.tar.gz | |
tar -xzvf fonts/lxgw-wenkai.tar.gz -C fonts | |
tree fonts -L 2 | |
- name: Set up Font Patcher | |
run: | | |
wget -q -O FontPatcher.zip https://github.com/ryanoasis/nerd-fonts/releases/latest/download/FontPatcher.zip | |
unzip FontPatcher.zip -d FontPatcher | |
chmod +x FontPatcher/font-patcher | |
- name: Patch fonts | |
run: | | |
mkdir patched-fonts | |
for font in fonts/**/*.ttf; do | |
echo "Processing: $font" | |
./FontPatcher/font-patcher --complete --quiet --careful "$font" -o patched-fonts/ | |
done | |
- name: Package fonts | |
run: | | |
mv patched-fonts lxgw-wenkai-nerd | |
tar -czvf lxgw-wenkai-nerd.tar.gz -C lxgw-wenkai-nerd . | |
zip -r lxgw-wenkai-nerd.zip lxgw-wenkai-nerd | |
- name: Create GitHub Release | |
uses: softprops/action-gh-release@v1 | |
with: | |
body: | | |
This release includes the patched LXGW WenKai fonts. | |
Original LXGW WenKai release: https://github.com/lxgw/LxgwWenKai/releases/tag/${{ env.LATEST_RELEASE }} | |
tag_name: ${{ env.LATEST_RELEASE }} | |
files: | | |
lxgw-wenkai-nerd.tar.gz | |
lxgw-wenkai-nerd.zip | |
env: | |
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} |