Unverified Commit 9b1e461e authored by Jonathan Tong's avatar Jonathan Tong Committed by GitHub
Browse files

ci: inline fern publish step into fern-docs workflow (#6091)


Signed-off-by: default avatarJont828 <jt572@cornell.edu>
parent 4f99451b
...@@ -24,11 +24,17 @@ ...@@ -24,11 +24,17 @@
# 2. SYNC vNEXT (push to main): Syncs fern/ from main to docs-website branch # 2. SYNC vNEXT (push to main): Syncs fern/ from main to docs-website branch
# - Triggers on push to main when fern/** files change # - Triggers on push to main when fern/** files change
# - Preserves versioned documentation snapshots on docs-website branch # - Preserves versioned documentation snapshots on docs-website branch
# - Publishes docs to Fern after syncing
# #
# 3. VERSION RELEASE (tags): Creates versioned documentation snapshot # 3. VERSION RELEASE (tags): Creates versioned documentation snapshot
# - Triggers on new version tags (vX.Y.Z format) # - Triggers on new version tags (vX.Y.Z format)
# - Creates pages-vX.Y.Z/ directory on docs-website branch # - Creates pages-vX.Y.Z/ directory on docs-website branch
# - Updates docs.yml with new version entry # - Updates docs.yml with new version entry
# - Publishes docs to Fern after releasing
#
# Note: The publish step is included inline because pushes made with GITHUB_TOKEN
# do not trigger other workflows (GitHub's anti-recursion guard), so we cannot
# rely on a separate publish-fern-docs.yml workflow for bot-initiated pushes.
name: Fern Docs name: Fern Docs
...@@ -250,6 +256,23 @@ jobs: ...@@ -250,6 +256,23 @@ jobs:
echo "Successfully synced vNext docs to docs-website branch" echo "Successfully synced vNext docs to docs-website branch"
- name: Setup Node.js
if: steps.changes.outputs.has_changes == 'true'
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Fern CLI
if: steps.changes.outputs.has_changes == 'true'
run: npm install -g fern-api
- name: Publish Docs
if: steps.changes.outputs.has_changes == 'true'
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
working-directory: fern-checkout/fern
run: fern generate --docs
############################################################################# #############################################################################
# VERSION RELEASE - Run on new version tags (vX.Y.Z) # VERSION RELEASE - Run on new version tags (vX.Y.Z)
############################################################################# #############################################################################
...@@ -426,3 +449,17 @@ jobs: ...@@ -426,3 +449,17 @@ jobs:
git push origin docs-website git push origin docs-website
echo "Successfully released documentation for $TAG on docs-website branch" echo "Successfully released documentation for $TAG on docs-website branch"
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Fern CLI
run: npm install -g fern-api
- name: Publish Docs
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
working-directory: ./fern
run: fern generate --docs
# SPDX-FileCopyrightText: Copyright (c) 2025-2026 NVIDIA CORPORATION & AFFILIATES. All rights reserved.
# SPDX-License-Identifier: Apache-2.0
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
# Fern docs publish workflow
# Publishes documentation to Fern when changes are pushed to the docs-website branch
#
# Required Configuration:
# - Secret: FERN_TOKEN (generated via `fern token` command, specific to organization)
#
# To generate FERN_TOKEN:
# 1. Install Fern CLI: npm install -g fern-api
# 2. Run: fern token
# 3. Add the token as a repository secret named FERN_TOKEN
name: Publish Fern Docs
on:
push:
branches:
- docs-website
paths:
- 'fern/**'
- '.github/workflows/publish-fern-docs.yml'
workflow_dispatch:
jobs:
publish:
runs-on: ubuntu-latest
# Skip the first run after repo creation
if: ${{ github.event_name == 'workflow_dispatch' || github.run_number > 1 }}
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: '20'
- name: Install Fern CLI
run: npm install -g fern-api
- name: Publish Docs
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
working-directory: ./fern
run: fern generate --docs
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment