aboutsummaryrefslogtreecommitdiff
path: root/services/docker/blog/install-hugo.bash
blob: a44813898b2832d7410d1af7b67beffdf284364b (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
#! /usr/bin/env bash

set -e

apt-get update
apt-get install -y tini locales curl git
rm -rf /var/lib/apt/lists/*
localedef -i en_US -c -f UTF-8 -A /usr/share/locale/locale.alias en_US.UTF-8

VERSION=$(curl -s https://api.github.com/repos/gohugoio/hugo/releases/latest | grep '"tag_name":' | sed -E 's/.*"v([^"]+)".*/\1/')

echo "The latest version of hugo is $VERSION."

url="https://github.com/gohugoio/hugo/releases/download/v${VERSION}/hugo_extended_${VERSION}_linux-amd64.deb"

echo "Download hugo from $url."

curl -sSfOL "$url"
dpkg -i "hugo_extended_${VERSION}_linux-amd64.deb"
rm "hugo_extended_${VERSION}_linux-amd64.deb"

echo "Hugo version: $(hugo version)."