Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
jekyll-build-pages/entrypoint.sh
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
executable file
58 lines (47 sloc)
1.8 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
#################################################################################################### | |
# | |
# Calls github-pages executable to build the site using allowed plugins and supported configuration | |
# | |
#################################################################################################### | |
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 | |
# 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"; then | |
echo "::warning:: github-pages can't satisfy your Gemfile's dependencies." | |
fi | |
# Set environment variables required by supported plugins | |
export JEKYLL_ENV="production" | |
export JEKYLL_GITHUB_TOKEN=$INPUT_TOKEN | |
export PAGES_REPO_NWO=$GITHUB_REPOSITORY | |
export JEKYLL_BUILD_REVISION=$INPUT_BUILD_REVISION | |
export PAGES_API_URL=$GITHUB_API_URL | |
# Set verbose flag | |
if [ "$INPUT_VERBOSE" = 'true' ]; then | |
VERBOSE='--verbose' | |
else | |
VERBOSE='' | |
fi | |
# Set future flag | |
if [ "$INPUT_FUTURE" = 'true' ]; then | |
FUTURE='--future' | |
else | |
FUTURE='' | |
fi | |
{ cd "$PAGES_GEM_HOME" || { echo "::error::pages gem not found"; exit 1; }; } | |
# Run the command, capturing the output | |
build_output="$($GITHUB_PAGES_BIN build "$VERBOSE" "$FUTURE" --source "$SOURCE_DIRECTORY" --destination "$DESTINATION_DIRECTORY")" | |
# Capture the exit code | |
exit_code=$? | |
if [ $exit_code -ne 0 ]; then | |
# Remove the newlines from the build_output as annotation not support multiline | |
error=$(echo "$build_output" | tr '\n' ' ' | tr -s ' ') | |
echo "::error::$error" | |
else | |
# Display the build_output directly | |
echo "$build_output" | |
fi | |
# Exit with the captured exit code | |
exit $exit_code |