Sha256: 59a8c5c825ade7ef35cb201d5fef6227f118e8b00202882e81ada73581c17f58

Contents?: true

Size: 1.23 KB

Versions: 3

Compression:

Stored size: 1.23 KB

Contents

#!/bin/bash
set -e

URL=$1
SRC=$(pwd)
TEMP=$(mktemp -d -t jgd-XXX)
trap "rm -rf ${TEMP}" EXIT
CLONE=${TEMP}/clone

echo -e "Cloning Github repository:"
git clone "${URL}" "${CLONE}"

echo -e "\nRegistering variables:"
cd "${CLONE}"
USER_EMAIL=$(git config --get user.email | cat)
USER_EMAIL=${USER_EMAIL:-"jgd@teamed.io"}
USER_NAME=$(git config --get user.name | cat)
USER_NAME=${USER_NAME:-"jekyll-github-deploy"}

VERSION=$(git describe --always --tag)

echo -e "\nBuilding Jekyll site:"
rm -rf _site

if [ -r _config-deploy.yml ]; then
  jekyll build --config _config.yml,_config-deploy.yml
else
  jekyll build
fi

if [ ! -e _site ]; then
  echo -e "\nJekyll didn't generate anything in _site!"
  exit -1
fi

cp -R _site ${TEMP}

echo -e "\nPreparing gh-pages branch:"
if [ -z "$(git branch -a | grep origin/gh-pages)" ]; then
  git checkout --orphan gh-pages
else
  git checkout gh-pages
fi

echo -e "\nDeploying into gh-pages branch:"
rm -rf *
cp -R ${TEMP}/_site/* .
rm -f README.md
git add .
git config user.email "${USER_EMAIL}"
git config user.name "${USER_NAME}"
git commit -am "new site version ${VERSION} deployed" --allow-empty
git push origin gh-pages 2>&1 | sed 's|'$URL'|[skipped]|g'

echo -e "\nCleaning up:"
rm -rf "${CLONE}"
rm -rf "${SITE}"

Version data entries

3 entries across 3 versions & 1 rubygems

Version Path
jgd-1.5.3 bash/deploy.sh
jgd-1.5.2 bash/deploy.sh
jgd-1.5.1 bash/deploy.sh