You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: fern/products/docs/pages/getting-started/publishing-your-docs.mdx
+120-9Lines changed: 120 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -2,21 +2,21 @@
2
2
title: Publishing your docs
3
3
---
4
4
5
-
When you are ready for your docs to be publicly accessible, you can publish them using the Fern CLI.
5
+
When you are ready for your docs to be publicly accessible, publish them using the Fern CLI. Choose one of the following approaches: publish [only to a production site](#publish-to-production), or [to separate staging and production sites](#publish-to-staging-and-production).
6
6
7
7
<Info>
8
8
Use the [Fern Dashboard](https://dashboard.buildwithfern.com) to manage CLI access and your GitHub repository connection.
9
9
</Info>
10
10
11
-
## Usage
11
+
## Publish to production
12
+
13
+
For a single production site (no staging environment), run the following command to publish your documentation:
12
14
13
15
```bash
14
16
fern generate --docs
15
17
```
16
18
17
-
### Example
18
-
19
-
```bash
19
+
```bash Example
20
20
fern generate --docs
21
21
[docs]: Found 0 errors and 1 warnings. Run fern check --warnings to print out the warnings.
22
22
[docs]: ✓ All checks passed
@@ -26,8 +26,9 @@ fern generate --docs
26
26
└─
27
27
```
28
28
29
-
### Usage in GitHub Actions
30
-
To automate the publishing process, you can use a GitHub Action workflow to publish your docs when a push is made to the `main` branch.
29
+
<Accordiontitle="Automate publishing process">
30
+
31
+
Use a GitHub Action workflow to publish your docs when a push is made to the `main` branch.
31
32
32
33
<Steps>
33
34
<Steptitle="Generate token">
@@ -66,14 +67,124 @@ jobs:
66
67
```
67
68
</Step>
68
69
</Steps>
70
+
</Accordion>
71
+
72
+
## Publish to staging and production
73
+
74
+
To preview changes on a staging site before publishing to production, define [multiple instances](/learn/docs/configuration/site-level-settings#instances-configuration) in your `docs.yml` file. Once you configure multiple instances, you must use the `--instance` flag when publishing.
75
+
76
+
<Steps>
77
+
<Step title="Configure instances">
78
+
79
+
Add both staging and production URLs to your `docs.yml` file. Don't include `https://` in the URLs.
80
+
81
+
```yaml docs.yml
82
+
instances:
83
+
- url: plantstore-prod.docs.buildwithfern.com
84
+
- url: plantstore-staging.docs.buildwithfern.com
85
+
```
86
+
</Step>
87
+
<Step title="Publish to a specific instance">
88
+
89
+
Use the `--instance` flag to publish to a specific environment:
After publishing, both instances will appear in the [Fern Dashboard](https://dashboard.buildwithfern.com).
100
+
101
+
</Step>
102
+
</Steps>
103
+
104
+
<Accordion title="Automate publishing process">
105
+
106
+
Use GitHub Action workflows to automatically deploy to staging on every push, while keeping production deployments manual.
107
+
108
+
<Steps>
109
+
<Step title="Generate token">
110
+
<Markdown src="/snippets/fern-token.mdx" />
111
+
</Step>
112
+
<Step title="Add token as a secret">
113
+
Add the token as a [repository secret](https://docs.github.com/en/actions/security-guides/using-secrets-in-github-actions#creating-secrets-for-a-repository) called `FERN_TOKEN`.
114
+
</Step>
115
+
<Step title="Set up automatic staging deployment workflow">
116
+
117
+
This workflow automatically publishes to your staging instance when changes are pushed to the `main` branch:
To deploy to production, go to the **Actions** tab in your GitHub repository, select the workflow, and click **Run workflow**.
177
+
</Step>
178
+
</Steps>
179
+
</Accordion>
69
180
70
181
## Hosting
71
182
72
183
When you publish your docs, Fern takes care of hosting them for you. You can also [publish your docs to a custom domain](/docs/preview-publish/setting-up-your-domain).
73
184
74
185
### Self-hosting your docs
75
186
76
-
If you need access to your docs offline or would like to host your docs on your own server, Fern [offers that option as well](/docs/self-hosted/overview). Self-hosted docs have limited access to certain features (including Ask Fern and analytics).
187
+
If you need access to your docs offline or would like to host your docs on your own server, Fern [offers that option as well](/docs/self-hosted/overview). Self-hosted docs have limited access to certain features (including Ask Fern and analytics).
77
188
78
189
## Unpublishing your docs
79
190
@@ -93,4 +204,4 @@ navigation: []
93
204
94
205
Publish the updated configuration by running `fern generate --docs`. This will remove all content from your site, and users visiting any page will see a 404 error.
0 commit comments