Skip to content

Commit

Permalink
standardize-and-complete-readmes: Allow to link releases
Browse files Browse the repository at this point in the history
[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 <[email protected]>
  • Loading branch information
Finii committed Jul 26, 2023
1 parent a2bd758 commit f29c62a
Show file tree
Hide file tree
Showing 3 changed files with 24 additions and 3 deletions.
2 changes: 2 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
23 changes: 21 additions & 2 deletions bin/scripts/standardize-and-complete-readmes.sh
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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
Expand Down Expand Up @@ -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')
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion src/readme-per-directory-addendum.md
Original file line number Diff line number Diff line change
Expand Up @@ -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`

Expand Down

0 comments on commit f29c62a

Please sign in to comment.