blob: 8c05641afcff2883909f8cd50a8216f24fb8105a [file] [log] [blame]
#!/usr/bin/env bash
set -e # halt script on error
URL="https://wayang.apache.org"
BASE_URL="/"
BRANCH_PAGE=asf-site
echo "url: \"${URL}\"" > _config.yml.tmp
echo "baseurl: \"${BASE_URL}\"" >> _config.yml.tmp
cat _config.yml | grep -v "url:" >> _config.yml.tmp
mv _config.yml.tmp _config.yml
bundle exec jekyll build
if [ "${VALIDATE}" != "" ]; then
bundle exec htmlproofer ./_site
else
echo "it will not validate the site"
fi
mkdir -p ../tmp
mv ./_site/* ../tmp
git checkout --orphan ${BRANCH_PAGE}
rm -rf ./*
rm .asf.yaml
rm .gitignore
rm .travis*
mv ../tmp/* ./
git add -A
git status
git commit -m "Lastest site built on successful travis build $TRAVIS_BUILD_NUMBER auto-pushed to github"
git remote set-url origin https://${USER}:${TOKEN}@github.com/${TRAVIS_REPO_SLUG}
git push origin --delete ${BRANCH_PAGE}
git push origin ${BRANCH_PAGE}:${BRANCH_PAGE}