Skip to content

Instantly share code, notes, and snippets.

@loranger
Created June 29, 2020 08:22
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save loranger/df6fc87eabc5b96d58a5c9290ada9953 to your computer and use it in GitHub Desktop.
Save loranger/df6fc87eabc5b96d58a5c9290ada9953 to your computer and use it in GitHub Desktop.
Get latest unicons release and convert svg as png
#!/usr/bin/env sh
rm -rf line
mkdir -p line
cd line
# Get latest release
echo "Finding latest release"
LOCATION=$(curl -s https://api.github.com/repos/Iconscout/unicons/releases/latest \
| grep "tag_name" \
| awk '{print "https://github.com/Iconscout/unicons/archive/" substr($2, 2, length($2)-3) ".zip"}')
# Download release
echo "Downloading latest release"
curl -s -L -o archive.zip $LOCATION
# Unzip svg line icons
echo "Extracting latest release"
unzip -jq archive.zip '*/svg/line/*' -d extract
# Convert svg to png
echo "Converting SVG files"
mogrify -background none -density 2304 -format png extract/*.svg
# Remove all svg
echo "Cleaning files"
rm archive.zip
# rm extract/*.svg
mv extract/*.png .
rm -rf extract
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment