Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use Netlify to build documentation preview for PRs #2646

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion jekyll/.ruby-version

This file was deleted.

1 change: 1 addition & 0 deletions jekyll/.ruby-version
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
3.3.3
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to stay 3.3.3 for now because Netlify uses rvm, which Ruby 3.3.4+ currently fails to build on its
containers due to:

And because Netlify doesn't allow installing apt packages, we can't address the issue to make the install succeed. So instead, we need to use a version of Ruby that can be built on Netlify's containers.

12 changes: 12 additions & 0 deletions netlify.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
[build]
base = "jekyll"
publish = "../docs"

# Set the baseurl to "/" and url to "$DEPLOY_PRIME_URL" so that the built site is served from the root
command = """
printf "url: \"$DEPLOY_PRIME_URL\"\nbaseurl: \"/\"" > _config_netlify.yml; \
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Since we want to build new sites for PR preview, the url will vary PR by PR. So this line is needed to dynamically generate suitable Jekyll configs for Netlify.
And because it needs to be dynamic, it can't be a committed _config_netlify.yml file.

bundle exec jekyll build --config _config.yml,_config_netlify.yml \
"""

# Only build if netlify.toml or jekyll files have changed
ignore = "git diff --quiet $CACHED_COMMIT_REF $COMMIT_REF netlify.toml jekyll"
Loading