Skip to content

Commit

Permalink
Fixes use of archive, archive patcher and cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
ryanoasis committed Jan 3, 2022
1 parent 2f429c8 commit e630dd1
Show file tree
Hide file tree
Showing 2 changed files with 50 additions and 12 deletions.
22 changes: 10 additions & 12 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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: |
Expand All @@ -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
Expand All @@ -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
Expand Down
40 changes: 40 additions & 0 deletions bin/scripts/archive-font-patcher.sh
Original file line number Diff line number Diff line change
@@ -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;

0 comments on commit e630dd1

Please sign in to comment.