Skip to content

Commit 18509f9

Browse files
committed
remove manual github actions step
1 parent aa8d9c2 commit 18509f9

File tree

1 file changed

+21
-78
lines changed

1 file changed

+21
-78
lines changed

fern/products/sdks/overview/typescript/publishing-to-npm.mdx

Lines changed: 21 additions & 78 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ groups:
9494
location: npm
9595
package-name: your-package-name
9696
config:
97-
namespaceExport: your-client-name
97+
namespaceExport: YourClientName
9898
github:
9999
repository: your-org/company-typescript
100100
```
@@ -206,84 +206,27 @@ Use [GitHub Actions](https://docs.github.com/en/actions/get-started/quickstart)
206206
1. **Save** your settings. Now GitHub can run the actions you configure.
207207

208208
</Step>
209-
<Step title="Set up a publishing workflow">
210-
211-
Use GitHub Actions to set up a workflow that automatically publishes your new releases to npm.
212-
213-
To get started, navigate to the **Actions** tab in your repositiory and select **set up a workflow yourself**. GitHub will automatically set up a blank yml file in a new `.github/workflows` directory.
214-
215-
Rename this file `ci.yml`. Your file should look like this:
216-
217-
```yaml title=".github/workflows/ci.yml" maxLines=0
218-
name: ci
219-
220-
on: [push]
221-
222-
jobs:
223-
compile:
224-
runs-on: ubuntu-latest
225-
226-
steps:
227-
- name: Checkout repo
228-
uses: actions/checkout@v4
229-
230-
- name: Set up node
231-
uses: actions/setup-node@v3
232-
233-
- name: Compile
234-
run: yarn && yarn build
235-
236-
test:
237-
runs-on: ubuntu-latest
238-
239-
steps:
240-
- name: Checkout repo
241-
uses: actions/checkout@v4
242-
243-
- name: Set up node
244-
uses: actions/setup-node@v3
245-
246-
- name: Compile
247-
run: yarn && yarn test
248-
249-
publish:
250-
needs: [ compile, test ]
251-
if: github.event_name == 'push' && contains(github.ref, 'refs/tags/')
252-
runs-on: ubuntu-latest
253-
steps:
254-
- name: Checkout repo
255-
uses: actions/checkout@v4
256-
- name: Set up node
257-
uses: actions/setup-node@v3
258-
- name: Install dependencies
259-
run: yarn install
260-
- name: Build
261-
run: yarn build
262-
263-
- name: Publish to npm
264-
run: |
265-
npm config set //registry.npmjs.org/:_authToken ${NPM_TOKEN}
266-
if [[ ${GITHUB_REF} == *alpha* ]]; then
267-
npm publish --access public --tag alpha
268-
elif [[ ${GITHUB_REF} == *beta* ]]; then
269-
npm publish --access public --tag beta
270-
else
271-
npm publish --access public
272-
fi
273-
env:
274-
NPM_TOKEN: ${{ secrets.NPM_TOKEN }}
209+
<Step title="Add token to `generators.yml`">
210+
211+
Add `token: ${NPM_TOKEN}` to `generators.yml` to tell Fern to use the `NPM_TOKEN` environment variable (which you just configured in your GitHub repo) for authentication when publishing to the npm registry.
212+
213+
```yaml {9}
214+
groups:
215+
ts-sdk:
216+
generators:
217+
- name: fernapi/fern-typescript-sdk
218+
version: <Markdown src="/snippets/typescript-sdk-version.mdx"/>
219+
output:
220+
location: npm
221+
package-name: name-of-your-package
222+
token: ${NPM_TOKEN}
223+
config:
224+
namespaceExport: YourClientName
225+
github:
226+
repository: your-org/your-repository
275227
```
276228

277-
For another example, see Vapi's [npm publishing GitHub Action](https://github.com/VapiAI/server-sdk-typescript/blob/main/.github/workflows/ci.yml)
278-
</Step>
279-
280-
<Step title="Update `.fernignore`">
281-
Once your workflow is configured, add your new workflow file to `.fernignore` so regenerating releases doesn't overwrite your workflow.
282-
283-
```diff title=".fernignore"
284-
+ .github/workflows/ci.yml
285-
```
286-
229+
When you regenerate your release, Fern will automatically create a workflow in your repository called `.github/workflows/ci.yml` that will automatically publish your release to npm. For an example, see Vapi's [npm publishing GitHub Action](https://github.com/VapiAI/server-sdk-typescript/blob/main/.github/workflows/ci.yml)
287230
</Step>
288231
</Steps>
289232

@@ -305,7 +248,7 @@ groups:
305248
package-name: name-of-your-package
306249
token: ${NPM_TOKEN}
307250
config:
308-
namespaceExport: your-client-name
251+
namespaceExport: YourClientName
309252
github:
310253
repository: your-org/your-repository
311254
```

0 commit comments

Comments
 (0)