From e630dd16970e3202745734dab44051f242e629cb Mon Sep 17 00:00:00 2001 From: Ryan L McIntyre Date: Mon, 3 Jan 2022 00:53:22 -0800 Subject: [PATCH] Fixes use of archive, archive patcher and cleanup --- .github/workflows/release.yml | 22 ++++++++-------- bin/scripts/archive-font-patcher.sh | 40 +++++++++++++++++++++++++++++ 2 files changed, 50 insertions(+), 12 deletions(-) create mode 100755 bin/scripts/archive-font-patcher.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 47446dec0..60375dc3d 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -138,12 +138,10 @@ jobs: ./generate-fontconfig.sh ./generate-casks.sh "${{ matrix.font }}" - # - 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 + - 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: | @@ -155,9 +153,11 @@ jobs: 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: | - "$GITHUB_WORKSPACE/patched-fonts/${{ matrix.font }}/" - "$GITHUB_WORKSPACE/LICENSE" + patched-fonts/${{ matrix.font }} + LICENSE commit: name: Commit and push patched fonts to the repo @@ -167,13 +167,11 @@ jobs: - uses: actions/checkout@v2 - name: Download patched fonts from build + id: download-patched-fonts uses: actions/download-artifact@v2 with: name: patched-fonts - path: "$GITHUB_WORKSPACE/patched-fonts/" - - - name: Display structure of downloaded files - run: ls -R + path: . # uncommment once structure is correct # - uses: EndBug/add-and-commit@v7 diff --git a/bin/scripts/archive-font-patcher.sh b/bin/scripts/archive-font-patcher.sh new file mode 100755 index 000000000..20c569428 --- /dev/null +++ b/bin/scripts/archive-font-patcher.sh @@ -0,0 +1,40 @@ +#!/usr/bin/env bash +# Nerd Fonts Version: 2.1.0 +# Script Version: 1.0.0 +# Archives the font patcher script and the required source files +# used for debugging +# set -x + +# LINE_PREFIX="# [Nerd Fonts]" +scripts_root_dir="$(cd "$(dirname "${BASH_SOURCE[0]}")" && pwd)/" +parent_dir="${PWD}/../../" +outputdir=$scripts_root_dir../../archives + +mkdir -p "$outputdir" + +# create a mini readme with basic info on Nerd Fonts project +touch "$outputdir/readme.md" +mini_readme="$outputdir/readme.md" +cat "$parent_dir/src/archive-font-patcher-readme.md" >> "$mini_readme" + +# clear out the directory zips +find "${outputdir:?}" -name "FontPatcher.zip" -type f -delete + +cd -- "$scripts_root_dir/../../" || exit 1 +find "src/glyphs" | zip -9 "$outputdir/FontPatcher" -@ +find "font-patcher" | zip -9 "$outputdir/FontPatcher" -@ + +# add mini readme file +zip -9 "$outputdir/FontPatcher" -rj "$mini_readme" -q +rm -f "$mini_readme" + +# @TODO check zip status +# zipStatus=$? + +# if [ "$zipStatus" != "0" ] +# then +# echo "$LINE_PREFIX error, font-patcher archive not created" +# exit 1 +# else +# echo "$LINE_PREFIX font-patcher archive created successfully" +# fi;