Skip to content

Commit

Permalink
Merge pull request ryanoasis#1044 from b-/release-master-fontpatcher
Browse files Browse the repository at this point in the history
Create FontPatcher.zip in repo up-to-date with master
  • Loading branch information
Finii authored Feb 17, 2023
2 parents 587a6b1 + b2fd78d commit 9c501ec
Show file tree
Hide file tree
Showing 2 changed files with 63 additions and 3 deletions.
54 changes: 54 additions & 0 deletions .github/workflows/zip-release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,54 @@
name: Create FontPatcher.zip

on:
push:
branches: master
paths:
- font-patcher
- src/glyphs/**
- src/archive-font-patcher-readme.me
- bin/scripts/archive-font-patcher.sh
- bin/scripts/name_parser/Fontname*.py
workflow_dispatch:

jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3

- name: Fetch dependencies
run: sudo apt install -y -q zipcmp

- name: Create archive
run: |
chmod u+x font-patcher bin/scripts/archive-font-patcher.sh
cd bin/scripts
./archive-font-patcher.sh intermediate
- name: Upload archive as artifact
uses: actions/upload-artifact@v3
with:
path: archives/FontPatcher.zip
retention-days: 1

- name: Check if archive contents changed
id: updated-or-not
run: |
(zipcmp archives/FontPatcher.zip ./FontPatcher.zip; \
echo "updated=$?" >> $GITHUB_OUTPUT) || true
- name: Prepare commit
if: steps.updated-or-not.outputs.updated != 0
run: cp -f archives/FontPatcher.zip .

- name: Commit new archive
uses: EndBug/add-and-commit@v9
if: steps.updated-or-not.outputs.updated != 0
with:
fetch: false
add: "FontPatcher.zip"
message: "[ci] Update FontPatcher.zip"
committer_name: GitHub Actions
committer_email: 41898282+github-actions[bot]@users.noreply.github.com
12 changes: 9 additions & 3 deletions bin/scripts/archive-font-patcher.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,8 @@
#!/usr/bin/env bash
# Nerd Fonts Version: 2.3.3
# Script Version: 1.0.0
# Script Version: 1.1.0
# Archives the font patcher script and the required source files
# If some (any) argument is given this is though of as intermediate version
# used for debugging
# set -x

Expand All @@ -16,14 +17,19 @@ mkdir -p "$outputdir"
touch "$outputdir/readme.md"
mini_readme="$outputdir/readme.md"
cat "$parent_dir/src/archive-font-patcher-readme.md" >> "$mini_readme"
if [ $# -ge 1 ]; then
echo "Intemediate version, adding git version"
echo -e "\n## Version\n" >> "$mini_readme"
echo "This archive is created from $(git describe --tags --dirty)" >> "$mini_readme"
fi

# 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 "src/glyphs" | zip -9 "$outputdir/FontPatcher" -@
find "bin/scripts/name_parser" -name "Fontname*.py" | zip -9 "$outputdir/FontPatcher" -@
find "font-patcher" | zip -9 "$outputdir/FontPatcher" -@
find "font-patcher" | zip -9 "$outputdir/FontPatcher" -@

# add mini readme file
zip -9 "$outputdir/FontPatcher" -rj "$mini_readme" -q
Expand Down

0 comments on commit 9c501ec

Please sign in to comment.