Files
blog/delivery/build.sh
T

29 lines
1.2 KiB
Bash
Executable File

#!/bin/sh
# Build the checked-out commit into an immutable release archive:
# delivery/.build/site.tar.gz and its .sha256. Needs full Git history
# (enableGitInfo) and the theme submodule.
set -eu
cd "$(dirname "$0")/.."
revision="$(git rev-parse HEAD)"
test -f themes/hugo_theme_pickles/theme.toml
build="$PWD/delivery/.build"
rm -rf "$build"
mkdir -p "$build"
# CI uses the pinned release; HUGO may name a local binary for previews only.
hugo="${HUGO:-$(python3 delivery/scripts/fetch_hugo.py --destination "$build/bin")}"
"$hugo" version
# --destination and --cacheDir override the legacy in-place publishDir.
"$hugo" --source . --environment production \
--destination "$build/hugo" --cacheDir "$build/cache" --cleanDestinationDir
python3 delivery/scripts/static_release.py build \
--source "$build/hugo" --output "$build/dist" --revision "$revision"
python3 delivery/scripts/static_release.py package \
--directory "$build/dist" \
--archive "$build/site.tar.gz" \
--checksum "$build/site.tar.gz.sha256"
python3 delivery/scripts/static_release.py inspect \
--archive "$build/site.tar.gz" \
--checksum "$build/site.tar.gz.sha256" \
--revision "$revision"
cat "$build/site.tar.gz.sha256"