Skip to content

Commit aef8eab

Browse files
stainless-botstainless-app[bot]
authored andcommitted
fix(ci): revert "move github release logic to github app" (#680)
1 parent 3e0299b commit aef8eab

File tree

5 files changed

+73
-12
lines changed

5 files changed

+73
-12
lines changed

.github/workflows/create-releases.yml

Lines changed: 64 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,64 @@
1+
name: Create releases
2+
on:
3+
schedule:
4+
- cron: '0 5 * * *' # every day at 5am UTC
5+
push:
6+
branches:
7+
- master
8+
9+
jobs:
10+
release:
11+
name: release
12+
if: github.ref == 'refs/heads/master' && github.repository == 'openai/openai-node'
13+
runs-on: ubuntu-latest
14+
environment: publish
15+
16+
steps:
17+
- uses: actions/checkout@v3
18+
19+
- uses: stainless-api/trigger-release-please@v1
20+
id: release
21+
with:
22+
repo: ${{ github.event.repository.full_name }}
23+
stainless-api-key: ${{ secrets.STAINLESS_API_KEY }}
24+
25+
- name: Generate a token
26+
id: generate_token
27+
uses: actions/create-github-app-token@v1
28+
with:
29+
app-id: ${{ secrets.APP_ID }}
30+
private-key: ${{ secrets.APP_PRIVATE_KEY }}
31+
owner: 'openai'
32+
repositories: 'openai-node,openai-deno-build'
33+
34+
- name: Set up Node
35+
if: ${{ steps.release.outputs.releases_created }}
36+
uses: actions/setup-node@v3
37+
with:
38+
node-version: '18'
39+
40+
- name: Set up Deno
41+
if: ${{ steps.release.outputs.releases_created }}
42+
uses: denoland/setup-deno@v1
43+
with:
44+
deno-version: v1.35.1
45+
46+
- name: Install dependencies
47+
if: ${{ steps.release.outputs.releases_created }}
48+
run: |
49+
yarn install
50+
51+
- name: Publish to NPM
52+
if: ${{ steps.release.outputs.releases_created }}
53+
run: |
54+
bash ./bin/publish-npm
55+
env:
56+
NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN || secrets.NPM_TOKEN }}
57+
58+
- name: Publish to Deno
59+
if: ${{ steps.release.outputs.releases_created }}
60+
run: |
61+
bash ./scripts/git-publish-deno.sh
62+
env:
63+
DENO_PUSH_REMOTE_URL: https://username:${{ steps.generate_token.outputs.token }}@github.com/openai/openai-deno-build.git
64+
DENO_PUSH_BRANCH: main

.github/workflows/publish-deno.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
# This workflow is triggered when a GitHub release is created.
2-
# It can also be run manually to re-publish to Deno in case it failed for some reason.
3-
# You can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-deno.yml
1+
# workflow for re-running publishing to Deno in case it fails for some reason
2+
# you can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-deno.yml
43
name: Publish Deno
54
on:
65
workflow_dispatch:
76

8-
release:
9-
types: [published]
10-
117
jobs:
128
publish:
139
name: publish

.github/workflows/publish-npm.yml

Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,13 +1,9 @@
1-
# This workflow is triggered when a GitHub release is created.
2-
# It can also be run manually to re-publish to NPM in case it failed for some reason.
3-
# You can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-npm.yml
1+
# workflow for re-running publishing to NPM in case it fails for some reason
2+
# you can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-npm.yml
43
name: Publish NPM
54
on:
65
workflow_dispatch:
76

8-
release:
9-
types: [published]
10-
117
jobs:
128
publish:
139
name: publish

.github/workflows/release-doctor.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,5 @@ jobs:
1919
run: |
2020
bash ./bin/check-release-environment
2121
env:
22+
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
2223
NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN || secrets.NPM_TOKEN }}

bin/check-release-environment

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,10 @@
22

33
errors=()
44

5+
if [ -z "${STAINLESS_API_KEY}" ]; then
6+
errors+=("The STAINLESS_API_KEY secret has not been set. Please contact Stainless for an API key & set it in your organization secrets on GitHub.")
7+
fi
8+
59
if [ -z "${NPM_TOKEN}" ]; then
610
errors+=("The OPENAI_NPM_TOKEN secret has not been set. Please set it in either this repository's secrets or your organization secrets")
711
fi

0 commit comments

Comments
 (0)