2020-11-03 02:18:15 +00:00
|
|
|
#! /usr/bin/env nix-shell
|
|
|
|
#! nix-shell -i bash -p curl jq
|
|
|
|
|
2020-11-06 00:33:48 +00:00
|
|
|
set -euo pipefail
|
|
|
|
cd "$(dirname "${BASH_SOURCE[0]}")"
|
2020-11-03 02:18:15 +00:00
|
|
|
|
|
|
|
release=$(curl -s https://api.github.com/repos/be5invis/Iosevka/releases/latest)
|
|
|
|
|
2020-11-06 00:33:48 +00:00
|
|
|
oldVersion=$(nix-instantiate --eval -E 'with import ../../../.. {}; lib.getVersion iosevka-bin' | tr -d '"')
|
2020-11-03 02:18:15 +00:00
|
|
|
version=$(echo "$release" | jq -r .tag_name | tr -d v)
|
|
|
|
|
|
|
|
if test "$oldVersion" = "$version"; then
|
2021-12-06 16:07:01 +00:00
|
|
|
echo "New version same as old version, nothing to do." >&2
|
|
|
|
exit 0
|
2020-11-03 02:18:15 +00:00
|
|
|
fi
|
|
|
|
|
2020-11-06 00:33:48 +00:00
|
|
|
sed -i "s/$oldVersion/$version/" bin.nix
|
2020-11-03 02:18:15 +00:00
|
|
|
|
|
|
|
{
|
2021-12-06 16:07:01 +00:00
|
|
|
echo '# This file was autogenerated. DO NOT EDIT!'
|
|
|
|
echo '{'
|
2024-04-21 15:54:59 +00:00
|
|
|
for asset in $(echo "$release" | jq -r '.assets[].name | select(startswith("PkgTTC"))'); do
|
2021-12-06 16:07:01 +00:00
|
|
|
printf ' %s = "%s";\n' \
|
2024-04-21 15:54:59 +00:00
|
|
|
$(echo "$asset" | sed -r "s/^PkgTTC-(.*)-$version.zip$/\1/") \
|
2021-12-06 16:07:01 +00:00
|
|
|
$(nix-prefetch-url "https://github.com/be5invis/Iosevka/releases/download/v$version/$asset")
|
|
|
|
done
|
|
|
|
echo '}'
|
2020-11-06 00:33:48 +00:00
|
|
|
} >variants.nix
|