From f29c62ab17493ccc5caa888060573a2cb5e541ff Mon Sep 17 00:00:00 2001 From: Fini Jastrow Date: Wed, 26 Jul 2023 14:10:28 +0200 Subject: [PATCH] standardize-and-complete-readmes: Allow to link releases [why] Some fonts will not be released to the repo; but only exist patched as release atrifacts. This needs adapted readmes. [how] If such a font is encountered direct links to the release archives are put into the readme file. Decide based on information in the font.json file. If no info is found in the json file (i.e. all existing fonts) it defaults to release-also-to-repo behavior. Signed-off-by: Fini Jastrow --- .github/workflows/release.yml | 2 ++ .../standardize-and-complete-readmes.sh | 23 +++++++++++++++++-- src/readme-per-directory-addendum.md | 2 +- 3 files changed, 24 insertions(+), 3 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b7eaa0ca0..958867122 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -307,6 +307,8 @@ jobs: committer_email: 41898282+github-actions[bot]@users.noreply.github.com - name: Commit patched fonts back to repo + # For fonts with repoRelease == false in the font.json the gitignore should + # have been setup in a way that this commits only the README.md uses: EndBug/add-and-commit@v9 with: fetch: false diff --git a/bin/scripts/standardize-and-complete-readmes.sh b/bin/scripts/standardize-and-complete-readmes.sh index e04cc7e0d..9a83ff2c5 100755 --- a/bin/scripts/standardize-and-complete-readmes.sh +++ b/bin/scripts/standardize-and-complete-readmes.sh @@ -1,6 +1,6 @@ #!/usr/bin/env bash # Nerd Fonts Version: 3.0.2 -# Script Version: 1.1.3 +# Script Version: 1.1.4 # Iterates over all patched fonts directories # converts all non markdown readmes to markdown (e.g., txt, rst) using pandoc # adds information on additional-variations and complete font variations @@ -18,6 +18,19 @@ cd "$sd/../../src/unpatched-fonts/" || { } +function appendGeneralInfo { + local dest=$1; shift + local fontname=$1; shift + local has_repo=$1; shift + if [ -n "${has_repo}" ] + then + downloadfrom="Or download the development version from the folders here" + else + downloadfrom="https://github.com/ryanoasis/nerd-fonts/releases/latest/${fontname}.zip or https://github.com/ryanoasis/nerd-fonts/releases/latest/${fontname}.tar.xz" + fi + sed -e "s|%DOWNLOADFROM%|${downloadfrom}|" "${sd}/../../src/readme-per-directory-addendum.md" >> "${dest}" +} + function appendRfnInfo { local config_rfn=$1; shift local config_rfn_substitue=$1; shift @@ -90,6 +103,12 @@ do unset config_rfn_substitue fi fi + unset release_to_repo + # This defaults to true if no info is given: + if [ "$(echo "$fontdata" | jq .repoRelease)" != "false" ] + then + release_to_repo=TRUE + fi fi mapfile -t RST < <(find "$searchdir" -type f -iname 'readme.rst') @@ -139,6 +158,6 @@ do } >> "$to" fi appendRfnInfo "$config_rfn" "$config_rfn_substitue" "$sd" "$to" - cat "$sd/../../src/readme-per-directory-addendum.md" >> "$to" + appendGeneralInfo "$to" "$base_directory" "$release_to_repo" done diff --git a/src/readme-per-directory-addendum.md b/src/readme-per-directory-addendum.md index 8e0489cb7..00817fc2f 100644 --- a/src/readme-per-directory-addendum.md +++ b/src/readme-per-directory-addendum.md @@ -21,7 +21,7 @@ Once you narrow down your font choice of family (`Droid Sans`, `Inconsolata`, et #### `Option 1: Download already patched font` * For a stable version download a font package from the [release page](https://github.com/ryanoasis/nerd-fonts/releases) - * Or download the development version from the folders here + * %DOWNLOADFROM% #### `Option 2: Patch your own font`