Skip to content

Commit

Permalink
Merge pull request #237 from openai/next
Browse files Browse the repository at this point in the history
chore: unreleased changes
  • Loading branch information
schnerd committed Aug 23, 2023
2 parents ddb2815 + cf9f672 commit 09e68c5
Show file tree
Hide file tree
Showing 12 changed files with 195 additions and 1 deletion.
28 changes: 28 additions & 0 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
# workflow for re-running publishing to NPM in case it fails for some reason
# you can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-npm.yml
name: Publish NPM
on:
workflow_dispatch:

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

steps:
- uses: actions/checkout@v3

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

- name: Install dependencies
run: |
yarn install
- name: Publish to NPM
run: |
bash ./bin/publish-npm
env:
NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN }}
23 changes: 23 additions & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
name: Release Doctor
on:
push:
branches:
- master
workflow_dispatch:

jobs:
release_doctor:
name: release doctor
runs-on: ubuntu-latest
environment: publish
if: github.repository == 'openai/openai-node' && (github.event_name == 'push' || github.event_name == 'workflow_dispatch' || startsWith(github.head_ref, 'release-please') || github.head_ref == 'next')

steps:
- uses: actions/checkout@v3

- name: Check release environment
run: |
bash ./bin/check-release-environment
env:
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN }}
39 changes: 39 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
name: Release
on:
push:
branches:
- master

jobs:
release:
name: release
if: github.ref == 'refs/heads/master' && github.repository == 'openai/openai-node'
runs-on: ubuntu-latest
environment: publish

steps:
- uses: actions/checkout@v3

- uses: stainless-api/trigger-release-please@v1
id: release
with:
repo: ${{ github.event.repository.full_name }}
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}

- name: Set up Node
if: ${{ steps.release.outputs.releases_created }}
uses: actions/setup-node@v3
with:
node-version: '16'

- name: Install dependencies
if: ${{ steps.release.outputs.releases_created }}
run: |
yarn install
- name: Publish to NPM
if: ${{ steps.release.outputs.releases_created }}
run: |
bash ./bin/publish-npm
env:
NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN }}
3 changes: 3 additions & 0 deletions .release-please-manifest.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
{
".": "4.1.0"
}
25 changes: 25 additions & 0 deletions bin/check-release-environment
Original file line number Diff line number Diff line change
@@ -0,0 +1,25 @@
#!/usr/bin/env bash

errors=()

if [ -z "${STAINLESS_API_KEY}" ]; then
errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organisation secrets on GitHub.")
fi

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

len=${#errors[@]}

if [[ len -gt 0 ]]; then
echo -e "Found the following errors in the release environment:\n"

for error in "${errors[@]}"; do
echo -e "- $error\n"
done

exit 1
fi

echo "The environment is ready to push releases!"
9 changes: 9 additions & 0 deletions bin/publish-npm
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
#!/usr/bin/env bash

set -eux

npm config set //registry.npmjs.org/:_authToken $NPM_TOKEN

yarn build
cd dist
yarn publish --access public
61 changes: 61 additions & 0 deletions release-please-config.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
{
"packages": {
".": {}
},
"$schema": "https://raw.githubusercontent.com/stainless-api/release-please/main/schemas/config.json",
"include-v-in-tag": true,
"include-component-in-tag": false,
"bump-minor-pre-major": true,
"bump-patch-for-minor-pre-major": true,
"pull-request-header": "Automated Release PR",
"changelog-sections": [
{
"type": "feat",
"section": "Features"
},
{
"type": "fix",
"section": "Bug Fixes"
},
{
"type": "perf",
"section": "Performance Improvements"
},
{
"type": "revert",
"section": "Reverts"
},
{
"type": "chore",
"section": "Chores"
},
{
"type": "docs",
"section": "Documentation"
},
{
"type": "style",
"section": "Styles"
},
{
"type": "refactor",
"section": "Refactors"
},
{
"type": "test",
"section": "Tests",
"hidden": true
},
{
"type": "build",
"section": "Build System"
},
{
"type": "ci",
"section": "Continuous Integration",
"hidden": true
}
],
"release-type": "node",
"extra-files": ["src/version.ts"]
}
1 change: 1 addition & 0 deletions src/_shims/fetch.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -56,4 +56,5 @@ export type {
_RequestInfo as RequestInfo,
_ResponseType as ResponseType,
_BodyInit as BodyInit,
_HeadersInit as HeadersInit,
};
1 change: 1 addition & 0 deletions src/_shims/fetch.node.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -60,4 +60,5 @@ export type {
_RequestInfo as RequestInfo,
_ResponseType as ResponseType,
_BodyInit as BodyInit,
_HeadersInit as HeadersInit,
};
2 changes: 2 additions & 0 deletions src/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -201,6 +201,8 @@ export namespace OpenAI {
export import toFile = Uploads.toFile;
export import fileFromPath = Uploads.fileFromPath;

export import RequestOptions = Core.RequestOptions;

export import Page = Pagination.Page;
export import PageResponse = Pagination.PageResponse;

Expand Down
2 changes: 2 additions & 0 deletions src/resources/fine-tuning/jobs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -185,6 +185,8 @@ export namespace FineTuningJob {
}

export interface FineTuningJobEvent {
id: string;

created_at: number;

level: 'info' | 'warn' | 'error';
Expand Down
2 changes: 1 addition & 1 deletion src/version.ts
Original file line number Diff line number Diff line change
@@ -1 +1 @@
export const VERSION = '4.1.0';
export const VERSION = '4.1.0'; // x-release-please-version

0 comments on commit 09e68c5

Please sign in to comment.