#!/usr/bin/env bash set -e # halt script on error # Get the list of added files compared to the origin/master (origin/master is the deployed branch) # New files will not be deployed at the moment of this check so htmlproofer should ignore those links refering them. ADDED_FILES=$(git diff --name-only --diff-filter=A origin/master) if grep -q "_docs" <<< $ADDED_FILES; then ADDITIONS=${ADDITIONS:+$ADDITIONS }micro-ros.github.io//docs ADDITIONS=${ADDITIONS:+$ADDITIONS }micro-ros.github.io/blob/master/_docs fi if grep -q "_posts" <<< $ADDED_FILES; then ADDITIONS=${ADDITIONS:+$ADDITIONS }micro-ros.github.io//blog fi IGNORE_HREFS=${IGNORE_HREFS:+$IGNORE_HREFS,}$(ruby -e "puts %w{ vimeo.com omg.org twitter.com renesas.com ieeexplore.ieee.org build.ros2.org emanual.robotis.com www.antratek.com ${ADDITIONS} }.map{|h| \"/#{h}/\"}.join(\",\")" ) echo "Ignoring urls: " $IGNORE_HREFS bundle exec jekyll build bundle exec htmlproofer --check_html --http-status-ignore "429,403" --check-favicon --assume-extension --alt-ignore "/.*/" --empty-alt-ignore --only-4xx --url-ignore $IGNORE_HREFS $@ ./_site