nerd-fonts/.github/workflows/release.yml
Fini Jastrow 6e37782fcf CI: Correct release script call to patch-em-all
[why]
The font matix contains the directory names of the font files. The
directory names are taken from
  bin/scripts/lib/fonts.json
and specifically extracted with
  bin/scripts/get-font-names-from-json.sho

That script returns the .folderNames

Later in the release script we use the folder name to limit the fonts
that patch-em-all shall process. Unfortunately patch-em-all could (until
the previous commit) just work with font-filenames and not with
directory names. But the matrix gives us just directory names.

This is for example a problem with this fonts:
$ ll src/unpatched-fonts/BigBlueTerminal
-rw-rw-r-- 1 fini fini 25632 Jan  1 14:03 BigBlue_Terminal_437TT.TTF
-rw-rw-r-- 1 fini fini 69964 Jan  1 14:03 BigBlue_TerminalPlus.TTF

The *directory* of that fonts is correctly noted in fonts.json as
"BigBlueTerminal" but the font files do not begin with that!

[how]
Now, that patch-em-all can also filter on the directory name, we just
need to utilized that in the workflow run. If the filter shall work on
directory names the first character needs to be a slash, so we just
prepend it to name we got from the matix.

Fixes: #824

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
2022-08-18 11:14:12 +02:00

210 lines
No EOL
6.6 KiB
YAML

# triggers a release or a release candidate based on the version defined in package.json
name: Release
on:
# Triggers the workflow on push or pull request events but only for the master branch
push:
branches: [ master ]
paths-ignore:
- 'images/**'
- '**.md'
- '.all-contributorsrc'
- 'chocolatey/**'
- 'bin/scripts/lib/**'
- 'Dockerfile'
- 'install.ps1'
- 'install.sh'
- 'LICENSE'
- 'package**'
# Allows you to run this workflow manually from the Actions tab
workflow_dispatch:
jobs:
setup-fonts-matrix:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
with:
ref: master
fetch-depth: '1'
-
id: set-matrix
run: |
cd -- $GITHUB_WORKSPACE/bin/scripts/
fontNames=$(./get-font-names-from-json.sh)
echo "${fontNames}"
echo "::set-output name=matrix::${fontNames}"
echo ${{ steps.set-matrix.outputs.matrix }}
outputs:
matrix: ${{ steps.set-matrix.outputs.matrix }}
# Workflow to build and install dependencies
build:
# The type of runner that the job will run on
runs-on: ubuntu-latest
needs: setup-fonts-matrix
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
strategy:
matrix:
font: ${{fromJson(needs.setup-fonts-matrix.outputs.matrix)}}
steps:
# Checks-out your repository under $GITHUB_WORKSPACE, so your job can access it
- uses: actions/checkout@v2
with:
ref: master
fetch-depth: '1'
- name: Set release variables
run: |
cd -- "$GITHUB_WORKSPACE"
cat package.json
RELEASE_TAG_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo "RELEASE_TAG_VERSION=$RELEASE_TAG_VERSION" >> $GITHUB_ENV
[[ "$RELEASE_TAG_VERSION" == *"-RC"* ]] && echo "RELEASE_CANDIDATE=true" || echo "RELEASE_CANDIDATE=false" >> $GITHUB_ENV
# Install and setup Dependencies
# @TODO cache the next 4 steps with actions/cache or upload
- name: Setup core dependencies
run: |
sudo apt update -y -q
sudo apt install software-properties-common -y -q
sudo apt update -y -q
sudo apt install fontforge -y -q
sudo apt install python3-fontforge -y -q
- name: Setup additional dependencies
run: |
pip install fonttools --quiet
- name: Build FreeType from source
run: |
wget http://downloads.sourceforge.net/project/freetype/freetype2/2.7/freetype-2.7.tar.gz --quiet
tar -zxf freetype-2.7.tar.gz
cd freetype-2.7
./configure
make --quiet
sudo make install --quiet
- name: Build Harfbuzz from source
run: |
wget http://www.freedesktop.org/software/harfbuzz/release/harfbuzz-1.3.4.tar.bz2 --quiet
tar -xjf harfbuzz-1.3.4.tar.bz2
cd harfbuzz-1.3.4
./configure
make --quiet
sudo make install --quiet
- name: Verify setup
run: |
fontforge --version
fontforge --version 2>&1 | grep libfontforge | awk '{print $NF}'
- name: Bump version for source files once
# @todo fixme - put in a separate job with the release env setup and output the release info
if: ${{ matrix.font == '3270' }}
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./version-bump.sh "$RELEASE_TAG_VERSION"
- name: Standardize the readme files
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./standardize-and-complete-readmes.sh "${{ matrix.font }}"
- name: Patch all the variations of the font family
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
fontforge --script ../../font-patcher --version
./gotta-patch-em-all-font-patcher\!.sh "/${{ matrix.font }}"
- name: Generate fontconfig and casks
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./generate-fontconfig.sh
./generate-casks.sh "${{ matrix.font }}"
- name: Archive font package zip files and upload for release
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./archive-fonts.sh "${{ matrix.font }}"
GITHUB_TOKEN=$GITHUB_TOKEN PRERELEASE=$RELEASE_CANDIDATE ./upload-archives.sh $RELEASE_TAG_VERSION "${{ matrix.font }}"
- name: Upload patched fonts as artifacts
uses: actions/upload-artifact@v2
with:
name: patched-fonts
# adding multiple paths (i.e. LICENSE) is a workaround to get a least common ancestor
# of the root directory for artifact path purposes
path: |
patched-fonts/${{ matrix.font }}
LICENSE
release-font-patcher:
name: Archive font patcher and add to release
needs: build
env:
GITHUB_ACCESS_TOKEN: ${{ secrets.ACCESS_TOKEN }}
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Set release variables
run: |
cd -- "$GITHUB_WORKSPACE"
cat package.json
RELEASE_TAG_VERSION=$(cat package.json \
| grep version \
| head -1 \
| awk -F: '{ print $2 }' \
| sed 's/[",]//g')
echo "RELEASE_TAG_VERSION=$RELEASE_TAG_VERSION" >> $GITHUB_ENV
[[ "$RELEASE_TAG_VERSION" == *"-RC"* ]] && echo "RELEASE_CANDIDATE=true" || echo "RELEASE_CANDIDATE=false" >> $GITHUB_ENV
- name: Archive font-patcher script for release
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
./archive-font-patcher.sh
- name: Archive font package zip files and upload for release
run: |
cd -- "$GITHUB_WORKSPACE/bin/scripts"
GITHUB_TOKEN=$GITHUB_TOKEN PRERELEASE=$RELEASE_CANDIDATE ./upload-archives.sh $RELEASE_TAG_VERSION "FontPatcher"
commit:
name: Commit and push patched fonts to the repo
needs: build
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v2
- name: Download patched fonts from build
id: download-patched-fonts
uses: actions/download-artifact@v2
with:
name: patched-fonts
path: .
- uses: EndBug/add-and-commit@v7
with:
add: 'patched-fonts'
message: Rebuilds patched fonts
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com