blob: fd6f1f206a815f81669412e4327672f5e6853d29 [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 pull origin ${BRANCH_PAGE} --allow-unrelated-histories
#git checkout ${BRANCH_PAGE}
REPO_URL=$(git remote get-url origin)
git clone --depth=50 --branch=${BRANCH_PAGE} ${REPO_URL} ../${BRANCH_PAGE}
cd ../${BRANCH_PAGE}
#delete the old file that it was not gerenated
rm -rf $(diff --exclude=".git" -q ../tmp/ ./ | awk '/Only in \.\//{print substr($3, 1, length($3)-1) "" $4}')
rsync -av ../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 ${BRANCH_PAGE}:${BRANCH_PAGE}