Add API documentation with GitHub Pages deployment #181
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds automated deployment of a versioned API documentation landing page using GitHub Pages. The landing page links to documentation hosted on RubyDoc.info, the de facto standard documentation site for the Ruby ecosystem. The landing page will update to reflect new releases.
Changes
Documentation generation script (see
bin/generate-gh-pages.sh)Copies and commits documentation files to the gh-pages branch. The script uses git worktrees to isolate the process from the main workspace.
The script:
1.2.3,v1.2.3, andrelease-1.2.3all createv1.2.3)docs/to the gh-pages root (for the latest version only)docs/_data/versions.ymlwith a list of all versions for the Jekyll templates to consumeJekyll template files (see
docs/directory)docs/_config.yml- Jekyll configurationdocs/index.md- Landing page template that links to all versions on RubyDoc.info based on generateddocs/_data/versions.ymldocs/latest/index.html- Redirect page template that redirects to the latest documentation on RubyDoc.infoGitHub Actions workflow (see
.github/workflows/release.yml)Added a
publish_gh_pagesjob that runs after thepublish_gemjob on release events. The job invokes the generation script with the release tag name, then pushes the updated gh-pages branch to deploy the documentation.CI validation (see
.github/workflows/ci.yml)Added a
yardjob that runs YARD validation with--no-output. This ensures YARD can successfully parse the codebase (without generating output), catching documentation issues early in CI.YARD dependencies (see
Gemfile)Added
yardandyard-sorbetgems as development dependencies to support documentation validation in CI.YARD documentation is automatically generated and hosted by RubyDoc.info when the gem is published to RubyGems.org.
Documentation links (see
README.mdandmcp.gemspec)Added links to the published API documentation on RubyDoc.info in the README and gemspec metadata.
Documentation URL
Custom documentation will be available at: https://modelcontextprotocol.github.io/ruby-sdk/
RubyDoc.info documentation will be accessible at:
You can see a preview of the landing page at: https://jonathan.hefner.pro/mcp-ruby-sdk/. (Ignore the v99.9.9 tag — I created that for testing purposes.)
Note that this page is fully customizable via
docs/index.md, and it can link to SDK-specific guides in the future.Eventually, I intend to link to this page from the
modelcontextprotocol.ioSDKs page. And, ultimately, I think it would be nice have something likesdks.modelcontextprotocol.iosuch thathttps://sdks.modelcontextprotocol.io/ruby-sdk/resolves tohttps://modelcontextprotocol.github.io/ruby-sdk/.If desired, I can also submit a PR for the
gh-pagesbranch to populatedocs/index.mdbefore the next release.