The (very WIP) home of the next versions of my web presences
1#!/usr/bin/env bash
2
3# Make bash fail on first error, unset variables, and pipe failures
4set -o errexit -o nounset -o pipefail
5
6# Set field separators to newlines and tabs only, for safer word splitting in loops
7IFS=$'\n\t'
8
9if [[ $# -eq 0 ]]; then
10 echo 'usage: build.sh <site name>'
11 exit 1
12fi
13
14if [[ $(uname) == "Linux" ]]; then
15 cat /proc/version;
16else
17 uname -v;
18fi
19
20RELEASES="https://github.com/chriskrycho/v6.chriskrycho.com/releases"
21LATEST="${RELEASES}/latest/download/lx-linux"
22OUTPUT="lx-cli"
23rm -f $OUTPUT
24
25echo "fetching '$LATEST' to '$OUTPUT'"
26curl --location \
27 --proto '=https' --tlsv1.2 \
28 --silent --show-error --fail \
29 --output "$OUTPUT" \
30 "$LATEST" \
31 || exit $?
32
33chmod +x $OUTPUT
34
35# build the site!
36SITE_NAME="$1"
37echo "building '$SITE_NAME'"
38./lx-cli publish "./sites/${SITE_NAME}" || { echo "Build failed with exit code $?"; }
39rm ./lx-cli