Skip to content

feat(ci): trigger publish on release tags, auto-register and prune versions#1292

Merged
lalitadithya merged 1 commit into
NVIDIA:mainfrom
pdmack:pdmack/fern-publish-release-tags
May 15, 2026
Merged

feat(ci): trigger publish on release tags, auto-register and prune versions#1292
lalitadithya merged 1 commit into
NVIDIA:mainfrom
pdmack:pdmack/fern-publish-release-tags

Conversation

@pdmack

@pdmack pdmack commented May 15, 2026

Copy link
Copy Markdown
Collaborator

Summary

Switch Fern publish from docs/v* tags to release tags. On release tag push, auto-register the version in the Fern dropdown and prune to keep Latest + 3 most recent. Pre-release tags (containing -) still trigger publish but skip registration and pruning.

Also hardens frozen checkout (glob guard, warning not error, MDX img self-closing fix) and switches version stamping from sed to yq.

Fixes #1291
Supersedes #1290

Type of Change

  • ✨ New feature
  • 🔨 Build/CI

Component(s) Affected

  • Documentation/CI

Testing

  • Manual testing completed
  • No breaking changes (or documented)

Checklist

  • Self-review completed
  • Ready for review

Summary by CodeRabbit

  • Chores
    • Updated documentation publishing workflow to automatically register documentation versions from release tags and maintain up to 3 versions while pruning older entries for cleaner documentation management.

Review Change Stack

@coderabbitai

coderabbitai Bot commented May 15, 2026

Copy link
Copy Markdown
Contributor
📝 Walkthrough

Walkthrough

The workflow is updated to trigger on semver release tags (v1.2.3) instead of manual docs tags, and automatically manages Fern documentation versions by generating version files, updating the docs index, pruning older entries beyond a configured limit, and committing changes back to the repository.

Changes

Fern Documentation Release-Based Versioning

Layer / File(s) Summary
Workflow trigger pattern and version retention config
.github/workflows/publish-fern-docs.yml
Updated trigger from docs/v* to v[0-9]*.[0-9]*.[0-9]* release tag pattern, documented new publish behavior on release tags with version skipping for pre-releases, and added MAX_VERSIONS environment variable to control version retention.
Version registration, pruning, and commit automation
.github/workflows/publish-fern-docs.yml
Implemented three-step pipeline that generates fern/versions/<tag>.yml from the release's docs/index.yml, inserts corresponding entry into fern/docs.yml via yq, prunes old version entries and files to retain only the newest MAX_VERSIONS entries plus Latest, and conditionally commits and pushes updated fern/ metadata back to main.

Estimated code review effort

🎯 2 (Simple) | ⏱️ ~12 minutes

Possibly related issues

Possibly related PRs

  • NVIDIA/NVSentinel#1290: Concurrent modification of the same publish-fern-docs.yml workflow to automate Fern docs version registration and pruning with yq-based YAML manipulation.

Suggested reviewers

  • lalitadithya

Poem

🐰 A rabbit hops through release tags so bright,
Versions now register—no manual might!
With yq it prunes the old with care,
Three versions to keep—the newest pair.
From docs to docs, automation takes flight!

🚥 Pre-merge checks | ✅ 5
✅ Passed checks (5 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title accurately describes the main changes: triggering on release tags and auto-registering/pruning versions in the workflow.
Linked Issues check ✅ Passed The PR implements all coding requirements from issue #1291: trigger on vX.Y.Z tags, auto-register versions, prune to Latest+3 versions, handle pre-release tags, and use yq for YAML manipulation.
Out of Scope Changes check ✅ Passed The changes are limited to the GitHub Actions workflow configuration file and directly address the stated objectives without introducing unrelated modifications.
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Comment @coderabbitai help to get the list of available commands and usage tips.

lalitadithya
lalitadithya previously approved these changes May 15, 2026
@github-actions

Copy link
Copy Markdown
Contributor

…rsions

Switch publish trigger from docs/v* to release tags (v[0-9]*.[0-9]*.[0-9]*).
On release tag push, auto-register the version in the Fern dropdown and
prune to keep Latest + 3 most recent. Pre-release tags (containing '-')
still trigger publish but skip version registration and pruning.

Also hardens frozen checkout (glob guard, warning not error, MDX img fix)
and switches version stamping from sed to yq.

Co-Authored-By: Claude Opus 4.6 (1M context) <[email protected]>
@pdmack pdmack dismissed lalitadithya’s stale review May 15, 2026 18:43

The merge-base changed after approval.

@pdmack pdmack force-pushed the pdmack/fern-publish-release-tags branch from 0e5632c to d75b279 Compare May 15, 2026 18:43

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Caution

Some comments are outside the diff and can’t be posted inline due to platform limitations.

⚠️ Outside diff range comments (1)
.github/workflows/publish-fern-docs.yml (1)

40-45: ⚠️ Potential issue | 🟠 Major | 🏗️ Heavy lift

Publish from the tag, not from main.

Line 44 makes a tag-triggered run build from main, so a vX.Y.Z publish can drift from the tagged snapshot if main has moved by the time the job starts. It also leaves the later metadata push racing any new commits that land on main during the run. Use one checkout at ${{ github.ref }} for publishing/frozen-content extraction and a separate fresh checkout of main for the registration commit.

Also applies to: 95-107

🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/publish-fern-docs.yml around lines 40 - 45, The workflow
currently checks out main for a tag-triggered run (the actions/checkout step
using ref: main), which can cause the published artifacts to drift; change that
checkout to use the triggering ref (use ref: ${{ github.ref }} or equivalent) so
the publish builds from the tagged snapshot, and add a second, separate checkout
step that explicitly checks out main (fresh actions/checkout@...) to perform the
registration/metadata commit; update references in the later registration/push
steps to use that second checkout workspace so publication is frozen to the tag
while registration uses the latest main.
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Outside diff comments:
In @.github/workflows/publish-fern-docs.yml:
- Around line 40-45: The workflow currently checks out main for a tag-triggered
run (the actions/checkout step using ref: main), which can cause the published
artifacts to drift; change that checkout to use the triggering ref (use ref: ${{
github.ref }} or equivalent) so the publish builds from the tagged snapshot, and
add a second, separate checkout step that explicitly checks out main (fresh
actions/checkout@...) to perform the registration/metadata commit; update
references in the later registration/push steps to use that second checkout
workspace so publication is frozen to the tag while registration uses the latest
main.

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: ef210535-02aa-462b-bb51-95a64a44c223

📥 Commits

Reviewing files that changed from the base of the PR and between eba11e7 and 0e5632c.

📒 Files selected for processing (2)
  • .github/workflows/fern-docs-preview-build.yml
  • .github/workflows/publish-fern-docs.yml

@coderabbitai coderabbitai Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

🧹 Nitpick comments (1)
.github/workflows/publish-fern-docs.yml (1)

84-84: 💤 Low value

Consider using standard yq syntax for the slug extraction.

The .products[0].versions[$KEEP:].[].slug syntax works but the leading . before [] is unusual. The more conventional form would be .products[0].versions[$KEEP:][].slug.

♻️ Optional: use conventional yq iterator syntax
-          PRUNED=$(yq ".products[0].versions[$KEEP:].[].slug" fern/docs.yml)
+          PRUNED=$(yq ".products[0].versions[$KEEP:][].slug" fern/docs.yml)
🤖 Prompt for AI Agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

In @.github/workflows/publish-fern-docs.yml at line 84, The yq query in the
PRUNED assignment uses an unusual leading dot before the iterator
(.products[0].versions[$KEEP:].[].slug); update the query used by the
PRUNED=$(yq "...") command to the conventional iterator form
.products[0].versions[$KEEP:][].slug so the slug extraction uses standard yq
syntax (replace the ".[] " segment with "[]").
🤖 Prompt for all review comments with AI agents
Verify each finding against current code. Fix only still-valid issues, skip the
rest with a brief reason, keep changes minimal, and validate.

Nitpick comments:
In @.github/workflows/publish-fern-docs.yml:
- Line 84: The yq query in the PRUNED assignment uses an unusual leading dot
before the iterator (.products[0].versions[$KEEP:].[].slug); update the query
used by the PRUNED=$(yq "...") command to the conventional iterator form
.products[0].versions[$KEEP:][].slug so the slug extraction uses standard yq
syntax (replace the ".[] " segment with "[]").

ℹ️ Review info
⚙️ Run configuration

Configuration used: Path: .coderabbit.yaml

Review profile: CHILL

Plan: Enterprise

Run ID: 88be6808-0748-4cae-820a-49cc5dc4a950

📥 Commits

Reviewing files that changed from the base of the PR and between 0e5632c and d75b279.

📒 Files selected for processing (1)
  • .github/workflows/publish-fern-docs.yml

@pdmack

pdmack commented May 15, 2026

Copy link
Copy Markdown
Collaborator Author

Re: CodeRabbit's note about checking out main vs the tag —

The frozen version checkout step already extracts docs content via git archive "refs/tags/$version", not from the working tree. So versioned content is pinned to the tag regardless of what main looks like at checkout time. The only content that comes from main is the "Latest" entry, which is intentional — Latest should reflect the current state of main.

The ref: main checkout is needed for the commit-back step (registering the new version entry in fern/docs.yml). Splitting into two checkouts would add complexity without meaningful safety gain here.

Leaving as-is.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Feature]: Automate Fern version registration on release tags with N-3 pruning

2 participants