From 27bfc9ad5a5b09913631eee73e81c6daa26db018 Mon Sep 17 00:00:00 2001 From: bri <284789+b-@users.noreply.github.com> Date: Mon, 9 Jan 2023 14:55:47 -0500 Subject: [PATCH 1/7] release master fontpatcher.zip --- .../release_master_fontpatcher-zip.yaml | 39 +++++++++++++++++++ 1 file changed, 39 insertions(+) create mode 100644 .github/workflows/release_master_fontpatcher-zip.yaml diff --git a/.github/workflows/release_master_fontpatcher-zip.yaml b/.github/workflows/release_master_fontpatcher-zip.yaml new file mode 100644 index 0000000000..0a5badcf46 --- /dev/null +++ b/.github/workflows/release_master_fontpatcher-zip.yaml @@ -0,0 +1,39 @@ +name: Release font patcher from master + +on: + create: + push: + workflow_dispatch: + + +jobs: + build: + runs-on: ubuntu-latest + + steps: +# - uses: actions/checkout@v3 + + + - name: Grab the script and its dependencies from the repo + run: | + #!/bin/sh + git clone \ + --depth 1 \ + --single-branch \ + --quiet --progress \ + --no-checkout \ + https://oauth2:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY} + cd nerd-fonts && git checkout HEAD src font-patcher + + - run: rm -fR nerd-fonts/src/unpatched-fonts + + - run: zip -r fontpatcher.zip nerd-fonts/* + + - run: git config user.name "Github Actions" && git config user.email "actions@github.com" + working-directory: nerd-fonts + + - working-directory: nerd-fonts + run: cp -f ../fontpatcher.zip . && git add fontpatcher.zip && git commit -m"Update fontpatcher.zip" + + - uses: mxschmitt/action-tmate@v3 + From be8c8d55f5d10120bb6ab29abcf0fdfe2c51a4e8 Mon Sep 17 00:00:00 2001 From: bri <284789+b-@users.noreply.github.com> Date: Mon, 9 Jan 2023 16:52:30 -0500 Subject: [PATCH 2/7] let's change things, a lot --- .../release_master_fontpatcher-zip.yaml | 55 ++++++++++--------- 1 file changed, 30 insertions(+), 25 deletions(-) diff --git a/.github/workflows/release_master_fontpatcher-zip.yaml b/.github/workflows/release_master_fontpatcher-zip.yaml index 0a5badcf46..79b58d37e8 100644 --- a/.github/workflows/release_master_fontpatcher-zip.yaml +++ b/.github/workflows/release_master_fontpatcher-zip.yaml @@ -3,6 +3,13 @@ name: Release font patcher from master on: create: push: + paths: + - font-patcher + - src/glyphs/** + - src/archive-font-patcher-readme.me + - bin/scripts/archive-font-patcher.sh + - bin/scripts/name_parser + - .github/workflows/release_master_fontpatcher-zip.yaml workflow_dispatch: @@ -11,29 +18,27 @@ jobs: runs-on: ubuntu-latest steps: -# - uses: actions/checkout@v3 - - - - name: Grab the script and its dependencies from the repo - run: | - #!/bin/sh - git clone \ - --depth 1 \ - --single-branch \ - --quiet --progress \ - --no-checkout \ - https://oauth2:${{ secrets.GITHUB_TOKEN }}@github.com/${GITHUB_REPOSITORY} - cd nerd-fonts && git checkout HEAD src font-patcher - - - run: rm -fR nerd-fonts/src/unpatched-fonts - - - run: zip -r fontpatcher.zip nerd-fonts/* - - - run: git config user.name "Github Actions" && git config user.email "actions@github.com" - working-directory: nerd-fonts - - working-directory: nerd-fonts - run: cp -f ../fontpatcher.zip . && git add fontpatcher.zip && git commit -m"Update fontpatcher.zip" - - - uses: mxschmitt/action-tmate@v3 - + - name: Grab the script and its dependencies from the repo + uses: snow-actions/sparse-checkout@v1.2.0 + with: + patterns: | + font-patcher + src/glyphs + src/archive-font-patcher-readme.md + bin/scripts/archive-font-patcher.sh + bin/scripts/name_parser + + - run: chmod +x + font-patcher + bin/scripts/archive-font-patcher.sh + bin/scripts/name_parser + - run: bin/scripts/archive-font-patcher.sh + - run: cp archives/FontPatcher.zip . -f + - uses: EndBug/add-and-commit@v9 + 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 From b4fb18369d44c32ccf288a83bb465d1d04ca6cc8 Mon Sep 17 00:00:00 2001 From: bri <284789+b-@users.noreply.github.com> Date: Tue, 10 Jan 2023 12:16:58 -0500 Subject: [PATCH 3/7] On push to (specific paths within) master --- .github/workflows/release_master_fontpatcher-zip.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/.github/workflows/release_master_fontpatcher-zip.yaml b/.github/workflows/release_master_fontpatcher-zip.yaml index 79b58d37e8..aeeb7fbcd5 100644 --- a/.github/workflows/release_master_fontpatcher-zip.yaml +++ b/.github/workflows/release_master_fontpatcher-zip.yaml @@ -3,6 +3,7 @@ name: Release font patcher from master on: create: push: + branches: master paths: - font-patcher - src/glyphs/** From 9411186bbdacd806262014a17fbd5e8d247b6c67 Mon Sep 17 00:00:00 2001 From: bri <284789+b-@users.noreply.github.com> Date: Thu, 9 Feb 2023 14:37:03 -0500 Subject: [PATCH 4/7] add zipcmp conditional --- .../release_master_fontpatcher-zip.yaml | 23 +++++++++++++++---- 1 file changed, 19 insertions(+), 4 deletions(-) diff --git a/.github/workflows/release_master_fontpatcher-zip.yaml b/.github/workflows/release_master_fontpatcher-zip.yaml index aeeb7fbcd5..e62be353e3 100644 --- a/.github/workflows/release_master_fontpatcher-zip.yaml +++ b/.github/workflows/release_master_fontpatcher-zip.yaml @@ -3,7 +3,7 @@ name: Release font patcher from master on: create: push: - branches: master + #branches: master paths: - font-patcher - src/glyphs/** @@ -17,26 +17,41 @@ on: jobs: build: runs-on: ubuntu-latest - + outputs: + changed: ${{ steps.updated-or-not.outputs.updated }} steps: - + - name: install zipcmp + run: sudo apt-get install -y zipcmp - name: Grab the script and its dependencies from the repo uses: snow-actions/sparse-checkout@v1.2.0 with: patterns: | + FontPatcher.zip font-patcher src/glyphs src/archive-font-patcher-readme.md bin/scripts/archive-font-patcher.sh bin/scripts/name_parser - - run: chmod +x font-patcher bin/scripts/archive-font-patcher.sh bin/scripts/name_parser - run: bin/scripts/archive-font-patcher.sh + - uses: actions/upload-artifact@v2 + with: + name: FontPatcher.zip + path: archives/FontPatcher.zip + - id: updated-or-not + run: | + if zipcmp archives/FontPatcher.zip ./FontPatcher.zip ; then + echo "updated=false" | tee -a $GITHUB_OUTPUT + else + echo "updated=true" | tee -a $GITHUB_OUTPUT + fi - run: cp archives/FontPatcher.zip . -f - uses: EndBug/add-and-commit@v9 + if: steps.updated-or-not.outputs.updated == 'true' + #needs to be quoted with: fetch: false add: "FontPatcher.zip" From bc59f01e78daafef42a52f441a13845ec1a530f8 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Fri, 17 Feb 2023 06:53:52 +0100 Subject: [PATCH 5/7] Rename archiver script [why] It is not really a release, it is just a convenience for people that want to download the current master patcher with all accessories. Signed-off-by: Fini Jastrow --- .../{release_master_fontpatcher-zip.yaml => zip-release.yml} | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) rename .github/workflows/{release_master_fontpatcher-zip.yaml => zip-release.yml} (97%) diff --git a/.github/workflows/release_master_fontpatcher-zip.yaml b/.github/workflows/zip-release.yml similarity index 97% rename from .github/workflows/release_master_fontpatcher-zip.yaml rename to .github/workflows/zip-release.yml index e62be353e3..fa97ac15df 100644 --- a/.github/workflows/release_master_fontpatcher-zip.yaml +++ b/.github/workflows/zip-release.yml @@ -1,4 +1,4 @@ -name: Release font patcher from master +name: Create FontPatcher.zip from master on: create: From d563f56ab0b2fd2a4523c3f71ae88b427d5c29e8 Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Fri, 17 Feb 2023 06:57:49 +0100 Subject: [PATCH 6/7] Cleanup zip-release [why] Some changes to bring it in line with the other workflows. [how] Sorted from short to long: * Name all steps * Correct trigger * Remove unused output * Simplify zipcmp decision * Use apt instead of apt-get * Update upload-artifact action * Remove some trailing whitespace * Remove name from artifact to prevent strange double zip name * Use ordinary checkout instead of sparse - we need it anyhow to commit [note] Ok, 'simplify zipcmd decision' that might be matter of taste. Signed-off-by: Fini Jastrow --- .github/workflows/zip-release.yml | 70 ++++++++++++++----------------- 1 file changed, 32 insertions(+), 38 deletions(-) diff --git a/.github/workflows/zip-release.yml b/.github/workflows/zip-release.yml index fa97ac15df..68c0ede542 100644 --- a/.github/workflows/zip-release.yml +++ b/.github/workflows/zip-release.yml @@ -1,60 +1,54 @@ -name: Create FontPatcher.zip from master +name: Create FontPatcher.zip on: - create: push: - #branches: master + branches: master paths: - font-patcher - src/glyphs/** - src/archive-font-patcher-readme.me - bin/scripts/archive-font-patcher.sh - - bin/scripts/name_parser - - .github/workflows/release_master_fontpatcher-zip.yaml + - bin/scripts/name_parser/Fontname*.py workflow_dispatch: - jobs: build: runs-on: ubuntu-latest - outputs: - changed: ${{ steps.updated-or-not.outputs.updated }} steps: - - name: install zipcmp - run: sudo apt-get install -y zipcmp - - name: Grab the script and its dependencies from the repo - uses: snow-actions/sparse-checkout@v1.2.0 - with: - patterns: | - FontPatcher.zip - font-patcher - src/glyphs - src/archive-font-patcher-readme.md - bin/scripts/archive-font-patcher.sh - bin/scripts/name_parser - - run: chmod +x - font-patcher - bin/scripts/archive-font-patcher.sh - bin/scripts/name_parser - - run: bin/scripts/archive-font-patcher.sh - - uses: actions/upload-artifact@v2 + - 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 + + - name: Upload archive as artifact + uses: actions/upload-artifact@v3 with: - name: FontPatcher.zip path: archives/FontPatcher.zip - - id: updated-or-not + retention-days: 1 + + - name: Check if archive contents changed + id: updated-or-not run: | - if zipcmp archives/FontPatcher.zip ./FontPatcher.zip ; then - echo "updated=false" | tee -a $GITHUB_OUTPUT - else - echo "updated=true" | tee -a $GITHUB_OUTPUT - fi - - run: cp archives/FontPatcher.zip . -f - - uses: EndBug/add-and-commit@v9 - if: steps.updated-or-not.outputs.updated == 'true' - #needs to be quoted + (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" + message: "[ci] Update FontPatcher.zip" committer_name: GitHub Actions committer_email: 41898282+github-actions[bot]@users.noreply.github.com From 31cae9d07dc448ead5b6205152b7b1dbfc24458e Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Fri, 17 Feb 2023 08:47:00 +0100 Subject: [PATCH 7/7] archive-font-patcher: Include version in readme [why] If we create the zip file not only on releases we need some better version information inside. We can not use the same approach with real releases, because we add the tag at a later stage in the workflow. Signed-off-by: Fini Jastrow --- .github/workflows/zip-release.yml | 2 +- bin/scripts/archive-font-patcher.sh | 12 +++++++++--- 2 files changed, 10 insertions(+), 4 deletions(-) diff --git a/.github/workflows/zip-release.yml b/.github/workflows/zip-release.yml index 68c0ede542..8dd46b109f 100644 --- a/.github/workflows/zip-release.yml +++ b/.github/workflows/zip-release.yml @@ -25,7 +25,7 @@ jobs: run: | chmod u+x font-patcher bin/scripts/archive-font-patcher.sh cd bin/scripts - ./archive-font-patcher.sh + ./archive-font-patcher.sh intermediate - name: Upload archive as artifact uses: actions/upload-artifact@v3 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