Skip to content

Commit 45fb3ce

Browse files
authored
Update GitHub workflow in npm publishing guide (SDKs) (#567)
1 parent 3466ed4 commit 45fb3ce

File tree

4 files changed

+204
-129
lines changed

4 files changed

+204
-129
lines changed
Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
# This file configures all of your SDKs. It should be located at:
2+
# your-parent-repo/fern/generators.yml.
3+
default-group: local
4+
groups:
5+
local:
6+
generators:
7+
- name: fernapi/fern-typescript-sdk
8+
output:
9+
location: local-file-system
10+
path: ../sdks/typescript
11+
version: 2.6.4
12+
# This group configures a TypeScript SDK for npm publishing
13+
ts-sdk:
14+
generators:
15+
- name: fernapi/fern-typescript-sdk
16+
version: 2.6.4
17+
output:
18+
location: npm
19+
package-name: your-unique-package-name
20+
token: ${NPM_TOKEN}
21+
config:
22+
namespaceExport: YourClientName
23+
github:
24+
repository: your-company/ts-sdk
25+
# generator groups for other SDKs go here
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
# Add this file as: your-parent-repo/.github/workflows/typescript-publish.yml
2+
# This workflow should be in the same repository as your generators.yml, which
3+
# should point to the repository containing your TypeScript SDK code.
4+
5+
name: Publish TypeScript SDK
6+
7+
on:
8+
# Manually trigger a release from the GitHub UI. Triggering this workflow kicks
9+
# off the npm publishing process from your TypeScript SDK repository.
10+
workflow_dispatch:
11+
inputs:
12+
version:
13+
description: "The version of the TypeScript SDK that you would like to release"
14+
required: true
15+
type: string
16+
17+
jobs:
18+
release:
19+
runs-on: ubuntu-latest
20+
steps:
21+
- name: Checkout repo
22+
uses: actions/checkout@v4
23+
24+
- name: Install Fern CLI
25+
run: npm install -g fern-api
26+
27+
- name: Release TypeScript SDK
28+
env:
29+
FERN_TOKEN: ${{ secrets.FERN_TOKEN }}
30+
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
31+
run: |
32+
fern generate --group ts-sdk --version ${{ inputs.version }} --log-level debug

fern/products/sdks/github-setup.mdx

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@ Fern recommends a parent-child repository structure containing:
1414

1515
```bash
1616
├─ company-repo # Parent repository
17+
│ ├─ .github.workflows # Contains publishing workflows for all SDKs
1718
│ └─ fern/
1819
│ ├─ fern.config.json # Root-level config
1920
│ ├─ generators.yml # References child repos
@@ -89,7 +90,7 @@ Each SDK has its own repository with the following structure:
8990

9091
```bash
9192
typescript-sdk-repo/ # Individual SDK repository
92-
├─ .github/workflows/ # Publishing workflows
93+
├─ .github/workflows/ # Generated by Fern
9394
├─ scripts/
9495
├─ src/
9596
├─ tests/

0 commit comments

Comments
 (0)