#!/usr/bin/env bash

# Copyright (C) 2014-2019 Maciej Delmanowski <drybjed@gmail.com>
# Copyright (C) 2015-2019 DebOps <https://debops.org/>
# SPDX-License-Identifier: GPL-3.0-only

# Build Jekyll website

set -e

worktree=$(git config --get deploy.worktree)
public=$(git config --get deploy.public)

test -d "${worktree}" || mkdir -p "${worktree}"

cd "${worktree}" || exit 1

if [ -n "${public}" ] ; then
  if type jekyll > /dev/null ; then
    jekyll build --destination "${public}"
  fi
fi
