blob: 49a794318f8aa498d9883c138019241207494966 [file] [log] [blame]
#!/usr/bin/env bash
#
# Licensed to the Apache Software Foundation (ASF) under one or more
# contributor license agreements. See the NOTICE file distributed with
# this work for additional information regarding copyright ownership.
# The ASF licenses this file to You under the Apache License, Version 2.0
# (the "License"); you may not use this file except in compliance with
# the License. You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
set -e # halt script on error
URL="https://wayang.apache.org"
BASE_URL="/"
BRANCH_PAGE=asf-site
export JEKYLL_ENV="production"
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
cp DISCLAIMER ../tmp
cp LICENSE.TXT ../tmp
cp NOTICE.TXT ../tmp
git checkout --orphan ${BRANCH_PAGE}
rm -rf ./*
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}
git push origin --delete gh-pages
git push origin ${BRANCH_PAGE}:gh-pages