Skip to content

Commit

Permalink
feat(api): update via SDK Studio (#4)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-app[bot] authored and stainless-bot committed Nov 13, 2024
1 parent 7479721 commit d13a722
Show file tree
Hide file tree
Showing 5 changed files with 52 additions and 4 deletions.
32 changes: 32 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to NPM in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/prelude-so/node-sdk/actions/workflows/publish-npm.yml
name: Publish NPM
on:
workflow_dispatch:

release:
types: [published]

jobs:
publish:
name: publish
runs-on: ubuntu-latest

steps:
- uses: actions/checkout@v4

- name: Set up Node
uses: actions/setup-node@v3
with:
node-version: '18'

- name: Install dependencies
run: |
yarn install
- name: Publish to NPM
run: |
bash ./bin/publish-npm
env:
NPM_TOKEN: ${{ secrets.PRELUDE_NPM_TOKEN || secrets.NPM_TOKEN }}
1 change: 1 addition & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,5 @@ jobs:
run: |
bash ./bin/check-release-environment
env:
NPM_TOKEN: ${{ secrets.PRELUDE_NPM_TOKEN || secrets.NPM_TOKEN }}

14 changes: 14 additions & 0 deletions CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -91,3 +91,17 @@ To format and fix all lint issues automatically:
```sh
$ yarn fix
```

## Publishing and releases

Changes made to this repository via the automated release PR pipeline should publish to npm automatically. If
the changes aren't made through the automated pipeline, you may want to make releases manually.

### Publish with a GitHub workflow

You can release to package managers by using [the `Publish NPM` GitHub action](https://www.github.com/prelude-so/node-sdk/actions/workflows/publish-npm.yml). This requires a setup organization or repository secret to be set up.

### Publish manually

If you need to manually release a package, you can run the `bin/publish-npm` script with an `NPM_TOKEN` set on
the environment.
5 changes: 1 addition & 4 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,12 +11,9 @@ It is generated with [Stainless](https://www.stainlessapi.com/).
## Installation

```sh
npm install git+ssh://[email protected]:prelude-so/node-sdk.git
npm install @prelude.so/sdk
```

> [!NOTE]
> Once this package is [published to npm](https://app.stainlessapi.com/docs/guides/publish), this will become: `npm install @prelude.so/sdk`
## Usage

The full API of this library can be found in [api.md](api.md).
Expand Down
4 changes: 4 additions & 0 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

errors=()

if [ -z "${NPM_TOKEN}" ]; then
errors+=("The PRELUDE_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
fi

lenErrors=${#errors[@]}

if [[ lenErrors -gt 0 ]]; then
Expand Down

0 comments on commit d13a722

Please sign in to comment.