diff --git a/.github/workflows/zip-release.yml b/.github/workflows/zip-release.yml new file mode 100644 index 0000000000..8dd46b109f --- /dev/null +++ b/.github/workflows/zip-release.yml @@ -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 diff --git a/bin/scripts/archive-font-patcher.sh b/bin/scripts/archive-font-patcher.sh index 7696039f3b..21b0376a24 100755 --- a/bin/scripts/archive-font-patcher.sh +++ b/bin/scripts/archive-font-patcher.sh @@ -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 @@ -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