Skip to content
Merged
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
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ on:
jobs:
run:
runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
project: [docs-starter, versioning]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -17,4 +21,5 @@ jobs:
uses: fern-api/setup-fern-cli@v1

- name: Check API is valid
working-directory: ${{ matrix.project }}
run: fern check
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,10 @@ jobs:
permissions:
contents: read
pull-requests: write
strategy:
fail-fast: false
matrix:
project: [docs-starter, versioning]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -24,11 +28,12 @@ jobs:

- name: Generate preview URL
id: generate-docs
working-directory: ${{ matrix.project }}
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
HEAD_REF: ${{ github.head_ref }}
run: |
OUTPUT=$(fern generate --docs --preview --id "$HEAD_REF" 2>&1) || true
OUTPUT=$(fern generate --docs --preview --id "${HEAD_REF}-${{ matrix.project }}" 2>&1) || true
echo "$OUTPUT"
URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()')
echo "preview_url=$URL" >> $GITHUB_OUTPUT
Expand All @@ -40,7 +45,7 @@ jobs:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
PREVIEW_URL="${{ steps.generate-docs.outputs.preview_url }}"
CHANGED_FILES=$(git diff --name-only origin/main...HEAD -- '*.mdx' 2>/dev/null || echo "")
CHANGED_FILES=$(git diff --name-only origin/main...HEAD -- '${{ matrix.project }}/**/*.mdx' 2>/dev/null || echo "")

if [ -z "$CHANGED_FILES" ] || [ -z "$PREVIEW_URL" ]; then
echo "page_links=" >> $GITHUB_OUTPUT; exit 0
Expand All @@ -64,8 +69,8 @@ jobs:

- name: Create comment content
run: |
echo ":herb: **Preview your docs:** <${{ steps.generate-docs.outputs.preview_url }}>" > comment.md
echo ":herb: **Preview your docs (${{ matrix.project }}):** <${{ steps.generate-docs.outputs.preview_url }}>" > comment.md

if [ -n "${{ steps.page-links.outputs.page_links }}" ]; then
echo "" >> comment.md
echo "Here are the markdown pages you've updated:" >> comment.md
Expand All @@ -76,5 +81,5 @@ jobs:
uses: thollander/actions-comment-pull-request@v2.4.3
with:
filePath: comment.md
comment_tag: preview-docs
comment_tag: preview-docs-${{ matrix.project }}
mode: upsert
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,10 @@ jobs:
run:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/heads/main') && github.run_number > 1 }}
strategy:
fail-fast: false
matrix:
project: [docs-starter, versioning]
steps:
- name: Checkout repository
uses: actions/checkout@v4
Expand All @@ -17,6 +21,7 @@ jobs:
uses: fern-api/setup-fern-cli@v1

- name: Publish Docs
working-directory: ${{ matrix.project }}
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: fern generate --docs --log-level debug
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Example Fern docs projects. Each top-level folder is a self-contained example wi
| Example | Description | Live demo |
| --- | --- | --- |
| [`docs-starter`](./docs-starter) | Minimal starter project | [docs-starter.docs.buildwithfern.com](https://docs-starter.docs.buildwithfern.com) |
| [`docs-versioned`](./docs-versioned) | Versioned site with a version dropdown and a shared page | [versioning.docs.buildwithfern.com](https://versioning.docs.buildwithfern.com) |
| [`versioning`](./docs-versioned) | Versioned site with a version dropdown and a shared page | [versioning.docs.buildwithfern.com](https://versioning.docs.buildwithfern.com) |

## Use an example

Expand Down
2 changes: 0 additions & 2 deletions docs-starter/.github/CODEOWNERS

This file was deleted.

Loading