Files
jekyll-build-pages/entrypoint.sh
T

43 lines
1.3 KiB
Bash
Raw Normal View History

2021-12-14 11:25:38 -05:00
#!/bin/bash
2022-12-28 09:25:45 -08:00
####################################################################################################
2021-12-17 17:43:47 -05:00
#
2022-12-28 09:25:45 -08:00
# Calls github-pages executable to build the site using allowed plugins and supported configuration
2021-12-14 11:25:38 -05:00
#
2022-12-28 09:25:45 -08:00
####################################################################################################
2021-12-14 11:25:38 -05:00
set -o errexit
SOURCE_DIRECTORY=${GITHUB_WORKSPACE}/$INPUT_SOURCE
DESTINATION_DIRECTORY=${GITHUB_WORKSPACE}/$INPUT_DESTINATION
PAGES_GEM_HOME=$BUNDLE_APP_CONFIG
GITHUB_PAGES=$PAGES_GEM_HOME/bin/github-pages
# Check if Gemfile's dependencies are satisfied or print a warning
if test -e "$SOURCE_DIRECTORY/Gemfile" && ! bundle check --dry-run --gemfile "$SOURCE_DIRECTORY/Gemfile" >/dev/null 2>&1; then
echo "::warning:: github-pages can't satisfy your Gemfile's dependencies."
fi
2021-12-14 11:25:38 -05:00
# Set environment variables required by supported plugins
export JEKYLL_ENV="production"
export JEKYLL_GITHUB_TOKEN=$INPUT_TOKEN
export PAGES_REPO_NWO=$GITHUB_REPOSITORY
2022-01-06 13:17:41 -08:00
export JEKYLL_BUILD_REVISION=$INPUT_BUILD_REVISION
2021-12-14 11:25:38 -05:00
2021-12-27 14:45:57 -08:00
# Set verbose flag
if [ "$INPUT_VERBOSE" = 'true' ]; then
2021-12-14 11:25:38 -05:00
VERBOSE='--verbose'
else
VERBOSE=''
2021-12-14 11:25:38 -05:00
fi
2021-12-27 14:45:57 -08:00
# Set future flag
if [ "$INPUT_FUTURE" = 'true' ]; then
2021-12-27 14:45:57 -08:00
FUTURE='--future'
else
FUTURE=''
2021-12-27 14:45:57 -08:00
fi
2021-12-14 11:25:38 -05:00
2021-12-27 14:45:57 -08:00
cd "$PAGES_GEM_HOME"
2021-12-27 15:27:23 -08:00
$GITHUB_PAGES build "$VERBOSE" "$FUTURE" --source "$SOURCE_DIRECTORY" --destination "$DESTINATION_DIRECTORY"