The landing page for the Metasys Server API Documentation
When a pull request is opened or updated, a GitHub Actions workflow automatically builds a full site preview and posts a comment on the PR with a direct link to browse it. The comment updates as new commits are pushed, and the preview is cleaned up when the PR is closed.
This project depends on Ruby the language and Jekyll a static website generator.
Before attempting to preview locally you need to get your environment setup. The steps that we'll go through are
- Install Ruby
- Install the ruby programs
bundlerandjekyll - Setup git submodules to access the theme for this site.
Install Ruby (This varies by operating system). I recommend the instructions at the Jekyll website for your operating system. I recommend installing version 3.1.3 (at the time of writing as that is what it's been tested with most lately).
Install the programs bundler and jekyll.
gem install bundler:2.3.26 jekyll:3.9.3Those specific versions are recommended as that's the version of Jekyll used by GitHub Pages and that's the version of the bundler used to create the Gemfile.lock file.
The following steps need to be done once after cloning the repo
> git submodule init
> git submodule update --remote
> bundle install --path vendor/bundle # depending on your env, you may not need path parameterThis only needs to be done once per working directory. So if for some reason you were to clone this repository a second time to another location you would need to repeat this step to setup that working directory.
Note the --path parameter. If you installed a version of ruby using a ruby
version manager then you probably don't need that path as all dependencies will
be installed in a non admin location. But it never hurts to include that path if
you are uncertain. This just tells bundle where to install dependencies. (Some
installations of Ruby store all dependencies in an admin area where you wouldn't
normally have write access.)
Once the prerequisites are in place you can preview the site at any time:
> bundle exec jekyll serveThen in your browser open http://127.0.0.1:4000/api-landing/
If you want your browser to auto-reload while you make changes to the docs use
the --livereload parameter:
> bundle exec jekyll serve --livereloadThese instructions work using the built-in version of ruby which ships with
macOS 12 (Monterey)
> which ruby
/usr/bin/ruby
> ruby -v
ruby 2.6.8p205 (2021-07-07 revision 67951) [universal.arm64e-darwin21]
>The bundle install step above will typically fail when trying to install the
ffi dependency. At the time of writing there is no arm version of that
package. The trick is to run ruby in "intel" mode and install all the intel
versions of the libraries:
arch -x86_64 bundle install --path vendor/bundleLikewise, the --livereload switch fails when running the site in arm mode.
Instead issue the command in "intel" mode.
arch -x86_64 bundle exec jekyll serve --livereloadNote: I did not have issues with these dependencies when using Ruby 3.1.3 which
was installed using install-ruby.
PR previews are built and deployed by the GitHub Actions workflow
.github/workflows/pr-preview.yml. Here is how it works:
- When a PR is opened, updated, or reopened, the workflow posts a "building…"
comment on the PR, then builds the Jekyll site with a config override that
points the
urlandbaseurlat the preview's subdirectory on thegh-pagesbranch. - A small JavaScript shim is appended to
_site/assets/js/main.jsto fix extension-less links (e.g./api/v6→/api/v6.html). GitHub Pages handles these via content negotiation on the live site, but the static preview directory does not. When a new API version file is added toapi/, update the version list in this shim (search forv6-14-1inpr-preview.yml). - The built site is pushed to the
gh-pagesbranch underpr-preview/pr-<number>/. - The PR comment is updated with a direct link to the preview.
- When the PR is closed or merged, the preview directory is removed from
gh-pagesand the comment is updated.
Preview URLs follow the pattern:
https://jci-metasys.github.io/api-landing/pr-preview/pr-<number>/