Skip to content

Commit

Permalink
added github actions
Browse files Browse the repository at this point in the history
  • Loading branch information
fomalhautb committed Jun 14, 2024
1 parent 211a573 commit 0694f09
Show file tree
Hide file tree
Showing 5 changed files with 83 additions and 1 deletion.
23 changes: 23 additions & 0 deletions .github/workflows/check-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Fern Check

on:
pull_request:
push:
branches:
- main

jobs:
run:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Fern
run: npm install -g fern-api

- name: Check API is valid
run: fern check
33 changes: 33 additions & 0 deletions .github/workflows/preview-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
name: Preview Docs

on: pull_request

jobs:
run:
runs-on: ubuntu-latest
permissions: write-all
defaults:
run:
working-directory: ./docs
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Fern
run: npm install -g fern-api

- name: Generate preview URL
id: generate-docs
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: |
OUTPUT=$(fern generate --docs --preview 2>&1) || true
echo "$OUTPUT"
URL=$(echo "$OUTPUT" | grep -oP 'Published docs to \K.*(?= \()')
echo "Preview URL: $URL"
echo "🌿 Preview your docs: $URL" > preview_url.txt
- name: Comment URL in PR
uses: thollander/actions-comment-pull-request@v2.4.3
with:
filePath: preview_url.txt
25 changes: 25 additions & 0 deletions .github/workflows/publish-docs.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
name: Publish Docs

on:
push:
branches:
- main

jobs:
run:
runs-on: ubuntu-latest
if: ${{ github.event_name == 'push' && contains(github.ref, 'refs/heads/main') && github.run_number > 1 }}
defaults:
run:
working-directory: ./docs
steps:
- name: Checkout repository
uses: actions/checkout@v4

- name: Install Fern
run: npm install -g fern-api

- name: Publish Docs
env:
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
run: fern generate --docs --log-level debug
1 change: 1 addition & 0 deletions docs/fern/docs.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
instances:
- url: https://stack-auth.docs.buildwithfern.com
custom-domain: docs.stack-auth.com
title: Stack Auth Documentation

tabs:
Expand Down
2 changes: 1 addition & 1 deletion docs/fern/docs/pages/getting-started/users.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ Because it's so common, `useUser()` is also exposed as a standalone hook. This m

On Server Components, you don't need `useStackApp()`. Instead, you can just import the `StackServerApp` that you created in the previous chapter:

```tsx focus={5-6} title="Server user profile"
```tsx focus={4-5} title="Server user profile"
import { stackServerApp } from "@/stack";

export default async function MyComponent() {
Expand Down

0 comments on commit 0694f09

Please sign in to comment.