Move Docs to Fern (#1257)

This commit is contained in:
Iván Martínez 2023-11-16 23:25:14 +01:00 committed by GitHub
parent ff7e2bc9dd
commit f339f7608c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
19 changed files with 1713 additions and 0 deletions

19
.github/workflows/fern/fern-check.yml vendored Normal file
View file

@ -0,0 +1,19 @@
name: fern check
on:
pull_request:
branches:
- main
jobs:
fern-check:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Install Fern
run: npm install -g fern-api
- name: Check Fern API is valid
run: fern check

46
.github/workflows/fern/preview-docs.yml vendored Normal file
View file

@ -0,0 +1,46 @@
name: deploy preview docs
on:
pull_request:
branches:
- main
jobs:
preview-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Setup Node.js
uses: actions/setup-node@v4
with:
node-version: "18"
- name: Install Fern
run: npm install -g fern-api
- name: Generate Documentation Preview with Fern
id: generate_docs
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
output=$(fern generate --docs --preview)
echo "$output"
# Extract the URL
preview_url=$(echo "$output" | grep -oP '(?<=Published docs to )https://[^\s]*')
# Set the output for the step
echo "::set-output name=preview_url::$preview_url"
- name: Comment PR with URL using github-actions bot
uses: actions/github-script@v4
if: ${{ steps.generate_docs.outputs.preview_url }}
with:
script: |
const preview_url = '${{ steps.generate_docs.outputs.preview_url }}';
const issue_number = context.issue.number;
github.issues.createComment({
...context.repo,
issue_number: issue_number,
body: `Published docs preview URL: ${preview_url}`
})

24
.github/workflows/fern/publish-docs.yml vendored Normal file
View file

@ -0,0 +1,24 @@
name: publish docs
on:
push:
branches:
- main
jobs:
publish-docs:
runs-on: ubuntu-latest
steps:
- name: Checkout repo
uses: actions/checkout@v4
- name: Setup node
uses: actions/setup-node@v3
- name: Download Fern
run: npm install -g fern-api
- name: Generate and Publish Docs
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: fern generate --docs --log-level debug