Files
jekyll-build-pages/entrypoint.sh
T

44 lines
1.4 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_BIN=$PAGES_GEM_HOME/bin/github-pages
2021-12-14 11:25:38 -05:00
2023-06-29 17:15:58 -07:00
# Check if Gemfile's dependencies are satisfied or print a warning
2023-06-21 11:41:52 -04:00
if test -e "$SOURCE_DIRECTORY/Gemfile" && ! bundle check --dry-run --gemfile "$SOURCE_DIRECTORY/Gemfile"; 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
2023-06-29 17:15:58 -07:00
export PAGES_API_URL=$GITHUB_API_URL
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"
$GITHUB_PAGES_BIN build "$VERBOSE" "$FUTURE" --source "$SOURCE_DIRECTORY" --destination "$DESTINATION_DIRECTORY"