2023-12-15 16:39:09 +01:00

29 lines
594 B
Bash
Executable File

#!/bin/sh
BUILD_DIR=$1
HUGO_VERSION=$(grep 'hugoVersion' $BUILD_DIR/config.toml | cut -d '"' -f 2)
if [ -z "$HUGO_VERSION" ]; then
HUGO_VERSION=$(grep 'hugoVersion' $BUILD_DIR/config.yaml | cut -d '"' -f 2)
fi
if [ -z "$HUGO_VERSION" ]; then
HUGO_VERSION="0.111.2" # default version
fi
# Download and install Hugo
curl -s https://api.github.com/repos/gohugoio/hugo/releases/tags/v$HUGO_VERSION \
| grep browser_download_url \
| grep linux-amd64.deb \
| grep extended \
| cut -d '"' -f 4 \
| wget -i -
dpkg -i hugo*_linux-amd64.deb
rm hugo*_linux-amd64.deb
cd $BUILD_DIR
hugo