nerdfonts: update.sh: use releases api to generate shas
This commit is contained in:
@@ -1,73 +1,21 @@
|
||||
#!/usr/bin/env nix-shell
|
||||
#! nix-shell -i bash -p rsstail nix-prefetch
|
||||
#! nix-shell -i bash -p nix-prefetch jq
|
||||
|
||||
# NOTE: Before running this script, please make sure this list is up-to-date -
|
||||
# meaning there are no new fonts they provide at https://github.com/ryanoasis/nerd-fonts/releases/
|
||||
fonts=(
|
||||
"3270"
|
||||
Agave
|
||||
AnonymousPro
|
||||
Arimo
|
||||
AurulentSansMono
|
||||
BigBlueTerminal
|
||||
BitstreamVeraSansMono
|
||||
CascadiaCode
|
||||
CodeNewRoman
|
||||
Cousine
|
||||
DaddyTimeMono
|
||||
DejaVuSansMono
|
||||
DroidSansMono
|
||||
FantasqueSansMono
|
||||
FiraCode
|
||||
FiraMono
|
||||
Go-Mono
|
||||
Gohu
|
||||
Hack
|
||||
Hasklig
|
||||
HeavyData
|
||||
Hermit
|
||||
iA-Writer
|
||||
IBMPlexMono
|
||||
Inconsolata
|
||||
Iosevka
|
||||
JetBrainsMono
|
||||
Lekton
|
||||
LiberationMono
|
||||
Meslo
|
||||
Monofur
|
||||
Monoid
|
||||
Mononoki
|
||||
MPlus
|
||||
Noto
|
||||
OpenDyslexic
|
||||
Overpass
|
||||
ProFont
|
||||
ProggyClean
|
||||
RobotoMono
|
||||
ShareTechMono
|
||||
SourceCodePro
|
||||
SpaceMono
|
||||
Terminus
|
||||
Tinos
|
||||
Ubuntu
|
||||
VictorMono
|
||||
)
|
||||
latest_release=$(curl --silent https://api.github.com/repos/ryanoasis/nerd-fonts/releases/latest)
|
||||
version=$(jq -r '.tag_name' <<<"$latest_release")
|
||||
|
||||
releases_url="https://github.com/ryanoasis/nerd-fonts/releases.atom"
|
||||
|
||||
version="$(rsstail -1 -u "$releases_url" -H -l -r | sed -e '/^Title: /d' -e 's:.*/::' -e 's/^v//g' | sort -V | tail -1)"
|
||||
dirname="$(dirname "$0")"
|
||||
echo \""${version#v}"\" >"$dirname/version.nix"
|
||||
|
||||
echo Using version "$version"
|
||||
|
||||
dirname="$(dirname "$0")"
|
||||
echo \""$version"\" > "$dirname/version.nix"
|
||||
|
||||
base_url="https://github.com/ryanoasis/nerd-fonts/releases/download/v${version}"
|
||||
|
||||
printf '{\n' > "$dirname/shas.nix"
|
||||
|
||||
for font in "${fonts[@]}"; do
|
||||
printf '\t"%s" = "%s";\n' "$font" "$(nix-prefetch-url "${base_url}/${font}.zip")" >> "$dirname/shas.nix"
|
||||
done
|
||||
while
|
||||
read -r name
|
||||
read -r url
|
||||
do
|
||||
printf '\t"%s" = "%s";\n' "${name%.*}" "$(nix-prefetch-url "$url")" >>"$dirname/shas.nix"
|
||||
done < <(jq -r '.assets[] | .name, .browser_download_url' <<<"$latest_release")
|
||||
|
||||
printf '}\n' >> "$dirname/shas.nix"
|
||||
|
||||
Reference in New Issue
Block a user