Sha256: f4f35a70c5abeb074f3961ac38424258a0840dbf6ae3587d2c7e84c18c566171

Contents?: true

Size: 1.14 KB

Versions: 5

Compression:

Stored size: 1.14 KB

Contents

#!/bin/bash
set -x
set -e
set -o pipefail

URL=$1
BRANCH=$2
BRANCH_FROM=$3
DEPLOY_CONFIG=$4
BUNDLE=$5
DRAFTS=$6
SRC=$(pwd)
TEMP=$(mktemp -d -t jgd-XXX)
trap "rm -rf ${TEMP}" EXIT
CLONE=${TEMP}/clone
COPY=${TEMP}/copy

echo -e "Cloning Github repository:"
git clone -b "${BRANCH_FROM}" "${URL}" "${CLONE}"
cp -R ${CLONE} ${COPY}

cd "${CLONE}"

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

if [ -r ${DEPLOY_CONFIG} ]; then
  ${BUNDLE} jekyll build --config _config.yml,${DEPLOY_CONFIG} ${DRAFTS}
else
  ${BUNDLE} jekyll build ${DRAFTS}
fi

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

cp -R _site ${TEMP}

cd ${TEMP}
rm -rf ${CLONE}
mv ${COPY} ${CLONE}
cd ${CLONE}

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

echo -e "\nDeploying into ${BRANCH} branch:"
rm -rf *
cp -R ${TEMP}/_site/* .
rm -f README.md
git add .
git commit -am "new version $(date)" --allow-empty
git push origin ${BRANCH} 2>&1 | sed 's|'$URL'|[skipped]|g'

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

Version data entries

5 entries across 5 versions & 1 rubygems

Version Path
jgd-1.14.0 bash/deploy.sh
jgd-1.13.1 bash/deploy.sh
jgd-1.13.0 bash/deploy.sh
jgd-1.12 bash/deploy.sh
jgd-1.11 bash/deploy.sh