Publishing your docs
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, or to separate staging and production sites.
Use the Fern Dashboard to manage CLI access and your GitHub repository connection.
Publish to production
For a single production site (no staging environment), run the following command to publish your documentation:
Automate publishing process
Use a GitHub Action workflow to publish your docs when a push is made to the main branch.
Generate token
Use fern token to generate a token for authenticating the Fern CLI in CI/CD environments. The token is specific to your organization defined in fern.config.json and doesn’t expire.
Create workflow
Create a Publish Docs workflow (example), and reference the secret.
Publish to staging and production
To preview changes on a staging site before publishing to production, define multiple instances in your docs.yml file. Once you configure multiple instances, you must use the --instance flag when publishing.
Configure instances
Add both staging and production URLs to your docs.yml file. Don’t include https:// in the URLs.
Publish to a specific instance
Use the --instance flag to publish to a specific environment:
After publishing, both instances will appear in the Fern Dashboard.
Automate publishing process
Use GitHub Action workflows to automatically deploy to staging on every push, while keeping production deployments manual.
Generate token
Use fern token to generate a token for authenticating the Fern CLI in CI/CD environments. The token is specific to your organization defined in fern.config.json and doesn’t expire.
Hosting
When you publish your docs, Fern takes care of hosting them for you. You can also publish your docs to a custom domain.
Self-hosting your docs
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. Self-hosted docs have limited access to certain features (including Ask Fern and analytics).
Unpublishing your docs
If you need to take down your docs site, you cannot directly unpublish it. However, you can replace your content with an empty site to effectively remove all of your documentation.