Update fontlab-ci-ubuntuwine.yaml #41
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: FontLab CI Export on Ubuntu Wine | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
outputs: | |
fontlab_version: ${{ steps.get_version.outputs.version }} | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v2 | |
- name: Start Xvfb | |
run: | | |
export DISPLAY=:0 | |
Xvfb $DISPLAY -screen 0 1280x960x16 & | |
echo "DISPLAY=$DISPLAY" >> $GITHUB_ENV | |
- name: Install prerequisites | |
run: | | |
sudo dpkg --add-architecture i386 | |
sudo apt-get update | |
sudo apt-get install wine64 wine32 curl tree | |
wine winecfg -v win10 | |
wine64 winecfg -v win10 | |
wineboot | |
echo "WINEPREFIX=$HOME/.wine" >> $GITHUB_ENV | |
- name: Get FontLab Version | |
id: get_version | |
run: | | |
url="https://download.fontlab.com/fontlab-8/upd-win64.php" | |
redirectUrl=$(curl -s -i -H "Accept-Language: en-US,en;q=0.9" -A "Mozilla/5.0" -o /dev/null -w '%{redirect_url}' $url) | |
if [ -z "$redirectUrl" ]; then | |
echo "Could not find the redirect URL in the response headers." | |
exit 1 | |
fi | |
version=$(basename $redirectUrl | sed -e 's/FontLab-8-Win64-Install-//' -e 's/.exe//') | |
echo "version=$version" >> $GITHUB_OUTPUT | |
- name: Cache FontLab Installer | |
id: cache-installer | |
uses: actions/cache@v2 | |
with: | |
path: | | |
FontLab-Installer.exe | |
key: ${{ runner.os }}-fontlab-installer-${{ steps.get_version.outputs.version }} | |
- name: Download FontLab | |
if: steps.cache-installer.outputs.cache-hit != 'true' | |
run: | | |
url="https://download.fontlab.com/fontlab-8/upd-win64.php" | |
output="FontLab-Installer.exe" | |
curl -L -H "Accept-Language: en-US,en;q=0.9" -A "Mozilla/5.0" -o $output $url | |
- name: Install FontLab | |
run: | | |
installer="FontLab-Installer.exe" | |
DISPLAY=:0.0 wine "$installer" /NOCANCEL /SP- /VERYSILENT /SUPPRESSMSGBOXES | |
export WINE="$(which wine64)" | |
- name: Prep FontLab data folder | |
run: | | |
wineprefix_path=$(winepath -w "$HOME/.wine") | |
echo "Wine prefix path: $wineprefix_path" | |
fontlab_user_dir=$(winepath -u 'C:\users\'"$USER"'\Application Data\FontLab\FontLab 8') | |
echo "Wine FontLab directory: $fontlab_user_dir" | |
echo "FONTLAB_DATA_PATH=$fontlab_user_dir" >> $GITHUB_ENV | |
mkdir -p "$fontlab_user_dir" | |
cp "scripts/startupScript.py" "$fontlab_user_dir" | |
- name: Run FontLab and build script | |
run: | | |
export WINEDEBUG=+err | |
fontLabExe="C:\\Program Files\\FontLab\\FontLab 8\\FontLab 8.exe" | |
scriptPath=$(winepath -w "$(pwd)/scripts/build.vfpy") | |
echo "Running " "$fontLabExe" "$scriptPath" | |
DISPLAY=:0.0 wine64 "$fontLabExe" -display "$DISPLAY" "$scriptPath" 2>&1 | tee wine.log | |
- name: Test Exported Fonts | |
run: | | |
tree "/home/runner/work" | |
- name: Configure Git | |
run: | | |
git config user.name "GitHub Action" | |
git config user.email "action@github.com" | |
- name: Commit and Push Exported Fonts | |
run: | | |
outputDirectory="build" | |
distDirectory="fonts" | |
if [ -d $outputDirectory ]; then | |
mv $outputDirectory/*.ttf $distDirectory | |
fi | |
git add $distDirectory/*.ttf | |
commit=$(git commit -m "Update exported fonts") | |
if [ -n "$commit" ]; then | |
git push | |
else | |
echo "No new fonts to commit" | |
fi |