1
0
mirror of https://github.com/ryanoasis/nerd-fonts.git synced 2025-02-06 12:35:00 +02:00

fetch-archives: Add option to specify release tag

[why]
It fetches the release we did last, which can be a release candidate.
But we want the latest release, or some other specified one.

[how]
Add parameter for the version tag.

[note]
Also correct some docs.

Signed-off-by: Fini Jastrow <ulf.fini.jastrow@desy.de>
This commit is contained in:
Fini Jastrow 2022-11-29 16:34:24 +01:00 committed by Fini
parent 2c7c1f53f5
commit 44629bf663

View File

@ -1,16 +1,18 @@
#!/usr/bin/env bash
# Nerd Fonts Version: 2.3.0-RC
# Script Version: 1.0.0
# Script Version: 1.0.1
#
# Iterates over all patched fonts directories and fetches the current release zip files.
# It fetches the latest release, not release candidate
#
# set -x
#
# Example run with pattern matching:
# ./archive-fonts heavydata
# Example with same font names for different paths
# ./archive-fonts gohu
# Example runs
# ./fetch-archives
# ./fetch-archives v2.2.2
# ./fetch-archives v2.2.2 heavydata
# The following version is automatically updated on releases
version="2.3.0-RC"
LINE_PREFIX="# [Nerd Fonts] "
@ -24,11 +26,19 @@ cd "$scripts_root_dir/../../patched-fonts/" || {
exit 1
}
if [ $# -eq 0 ]; then
versiontag="v${version}"
else
versiontag=$1
fi
echo "${LINE_PREFIX} Fetching release archives with version tag '${versiontag}'"
# limit archiving to given pattern (first script param) or entire root folder if no param given:
if [ $# -eq 1 ]
if [ $# -eq 2 ]
then
pattern=$1
search_pattern="*$1*.zip"
pattern=$2
search_pattern="*$2*.zip"
echo "$LINE_PREFIX Limiting archive to pattern '$pattern'"
else
pattern=".*"
@ -40,7 +50,7 @@ find . -maxdepth 1 -iregex "\./$pattern" -type d |
while read -r filename
do
basename=$(basename "$filename")
echo >&2 "${LINE_PREFIX} Fetching v${version}/${basename}.zip"
curl --fail -Lso "${outputdir}/${basename}.zip" "https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}/${basename}.zip" \
echo >&2 "${LINE_PREFIX} Fetching ${versiontag}/${basename}.zip"
curl --fail -Lso "${outputdir}/${basename}.zip" "https://github.com/ryanoasis/nerd-fonts/releases/download/${versiontag}/${basename}.zip" \
|| echo " => error fetching"
done