Skip to content
Open
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
21 changes: 21 additions & 0 deletions .vale/styles/Microsoft/LICENSE
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
MIT License

Copyright (c) 2018 - 2019 Joseph Kato

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:

The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
11 changes: 6 additions & 5 deletions fern/products/home/pages/fern-instructions/sdks/publish.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -8,8 +8,9 @@ Use this to move an SDK from local output to a GitHub repo and a package registr

## Workflow

1. Create one GitHub repository per SDK and install the [Fern GitHub App](https://github.com/apps/fern-api) on it.
2. Set the target's output to GitHub and add publishing in `sdk-config.yml`:
1. For a first-time SDK or an API still in development, validate the generated SDK first: run `fern generate --target <language> --preview`, then build and test the output. Don't set up publishing until the user confirms it works. Published versions are available to their users immediately, and most registries don't allow deleting or replacing them.
2. Create one GitHub repository per SDK and install the [Fern GitHub App](https://github.com/apps/fern-api) on it.
3. Set the target's output to GitHub and add publishing in `sdk-config.yml`:

```yaml
targets:
Expand All @@ -27,9 +28,9 @@ Use this to move an SDK from local output to a GitHub repo and a package registr
```

`mode` is one of `release`, `pull-request`, `push`, `commit` or `commit-and-release`. Legacy `generators.yml` projects configure the same thing under each generator's `output` and `github`.
3. Add the registry credential as a GitHub Actions secret in the SDK repo (for example `NPM_TOKEN`). npm also supports trusted publishing (OIDC) with `trustedPublishing: true` instead of a token.
4. Generate with a version: `fern generate --target typescript --version 1.2.0`. Without `--version`, Fern picks one.
5. Merge the generated pull request (or let `release` mode publish). The SDK repo's workflow publishes the package.
4. Add the registry credential as a GitHub Actions secret in the SDK repo (for example `NPM_TOKEN`). npm also supports trusted publishing (OIDC) with `trustedPublishing: true` instead of a token.
5. Generate with a version: `fern generate --target typescript --version 1.2.0`. Without `--version`, Fern picks one.
6. Merge the generated pull request (or let `release` mode publish). The SDK repo's workflow publishes the package.

## Rules

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ The description, authors, keywords, and repository links on your package's nuget

## Configure GitHub publishing

<Warning title="Validate your SDK before you publish to NuGet">
If you're publishing an SDK for the first time or your API is still in development, validate the generated SDK before you set `output.publish.registry`. nuget.org doesn't allow deleting a published package version: you can only [unlist](https://learn.microsoft.com/en-us/nuget/nuget-org/policies/deleting-packages) it, and projects that reference that version can still install it. Generate a [local preview](/learn/sdks/deep-dives/local-previews) with `fern generate --target csharp --preview`, then build and test the output.
</Warning>

Fern can automatically publish your SDK to NuGet via GitHub Actions. Set `output.delivery` to `github`, configure your repository and publishing mode, and set `output.publish.registry` to `nuget`:

<Markdown src="/products/sdks/snippets/github-publishing-mode.mdx"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,11 @@ targets:

## Publish to pkg.go.dev

At this point, you're ready to generate a release for your SDK.
<Warning title="Validate your SDK before you release a version">
If you're publishing an SDK for the first time or your API is still in development, validate the generated SDK before you run `fern generate` with GitHub delivery. In the default `release` mode, every run pushes and tags a version, even without `--version`. pkg.go.dev indexes every semantic version tag pushed to a public repository, and the Go module proxy keeps a copy of each version permanently, so a released version can't be deleted, only [retracted](https://go.dev/ref/mod#go-mod-file-retract). Generate a [local preview](/learn/sdks/deep-dives/local-previews) with `fern generate --target go --preview`, then build and test the output.
</Warning>

At this point, you're ready to generate a release for your SDK.

<Steps>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ the SDK internally instead, generate to the local file system (optionally

## Configure Maven Central publication

<Markdown src="/products/sdks/snippets/validate-before-publishing.mdx"/>

Update the Java target in `sdk-config.yml` to configure the target repository, publishing mode, and registry. Your `sdk-config.yml` [should live in your source repository](/learn/sdks/overview/project-structure) (or on your local machine), not the repository that contains your Java SDK code.

<Markdown src="/products/sdks/snippets/github-publishing-mode.mdx"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ with [`fern generate --package`](/learn/cli-api-reference/cli-reference/sdk-comm

## Configure `sdk-config.yml`

<Markdown src="/products/sdks/snippets/validate-before-publishing.mdx"/>

PHP publishes via Git repositories, so the PHP target delivers to GitHub. Set `output.delivery` to `github` and add the path to your GitHub repository:

```yaml title="sdk-config.yml" {3-6}
Expand Down
2 changes: 2 additions & 0 deletions fern/products/sdks/generators/python/publishing-to-pypi.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,8 @@ Update the Python target in `sdk-config.yml` to configure the package name and c

## Configure GitHub publishing

<Markdown src="/products/sdks/snippets/validate-before-publishing.mdx"/>

Fern can automatically publish your SDK to PyPI via GitHub Actions. Set `output.delivery` to `github`, configure your repository and publishing mode, and set `output.publish.registry` to `pypi`:

<Markdown src="/products/sdks/snippets/github-publishing-mode.mdx"/>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,8 @@ internally instead, generate to the local file system (optionally

## Configure `sdk-config.yml`

<Markdown src="/products/sdks/snippets/validate-before-publishing.mdx"/>

Update the Ruby target in `sdk-config.yml` to configure the gem name, client name, and publishing destination. Your `sdk-config.yml` [should live in your source repository](/learn/sdks/overview/project-structure) (or on your local machine), not the repository that contains your Ruby SDK code.

<Steps>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,8 @@ internally instead, generate to the local file system (optionally

## Configure `sdk-config.yml`

<Markdown src="/products/sdks/snippets/validate-before-publishing.mdx"/>

Update the Rust target in `sdk-config.yml` to configure the crate name, client name, and publishing destination. Your `sdk-config.yml` [should live in your source repository](/learn/sdks/overview/project-structure) (or on your local machine), not the repository that contains your Rust SDK code.

<Steps>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ Publish your public-facing Fern Swift SDK as a Swift package distributed via Git

## Configure `sdk-config.yml`

<Markdown src="/products/sdks/snippets/validate-before-publishing.mdx"/>

Swift packages are distributed via Git repositories, so the Swift target delivers to GitHub. Set `output.delivery` to `github` and add the path to your GitHub repository:

```yaml title="sdk-config.yml" {3-6}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,8 @@ Update the TypeScript target in `sdk-config.yml` to configure the package name a

## Configure GitHub publishing

<Markdown src="/products/sdks/snippets/validate-before-publishing.mdx"/>

Fern can automatically publish your SDK to npmjs via GitHub Actions. Set `output.delivery` to `github`, configure your repository and publishing mode, and set `output.publish.registry` to `npm`:

<Markdown src="/products/sdks/snippets/github-publishing-mode.mdx"/>
Expand Down
3 changes: 3 additions & 0 deletions fern/products/sdks/snippets/validate-before-publishing.mdx
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
<Warning title="Validate your SDK before you publish">
If you're publishing an SDK for the first time or your API is still in development, set up publishing only after you've validated the generated SDK. A released version is available to your users immediately, and most registries don't allow you to delete or replace it. Generate a [local preview](/learn/sdks/deep-dives/local-previews) with `fern generate --target <language> --preview`, then build and test the output.
</Warning>
Loading