Skip to content

Commit

Permalink
fix(ci): revert "move github release logic to github app" (#680)
Browse files Browse the repository at this point in the history
  • Loading branch information
stainless-bot authored Feb 20, 2024
1 parent 3e0299b commit 8b4009a
Show file tree
Hide file tree
Showing 5 changed files with 73 additions and 12 deletions.
64 changes: 64 additions & 0 deletions .github/workflows/create-releases.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Create releases
on:
schedule:
- cron: '0 5 * * *' # every day at 5am UTC
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: Generate a token
id: generate_token
uses: actions/create-github-app-token@v1
with:
app-id: ${{ secrets.APP_ID }}
private-key: ${{ secrets.APP_PRIVATE_KEY }}
owner: 'openai'
repositories: 'openai-node,openai-deno-build'

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

- name: Set up Deno
if: ${{ steps.release.outputs.releases_created }}
uses: denoland/setup-deno@v1
with:
deno-version: v1.35.1

- 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 || secrets.NPM_TOKEN }}

- name: Publish to Deno
if: ${{ steps.release.outputs.releases_created }}
run: |
bash ./scripts/git-publish-deno.sh
env:
DENO_PUSH_REMOTE_URL: https://username:${{ steps.generate_token.outputs.token }}@github.com/openai/openai-deno-build.git
DENO_PUSH_BRANCH: main
8 changes: 2 additions & 6 deletions .github/workflows/publish-deno.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# This workflow is triggered when a GitHub release is created.
# It can also be run manually to re-publish to Deno in case it failed for some reason.
# You can run this workflow by navigating to https://www.github.com/openai/openai-node/actions/workflows/publish-deno.yml
# workflow for re-running publishing to Deno 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-deno.yml
name: Publish Deno
on:
workflow_dispatch:

release:
types: [published]

jobs:
publish:
name: publish
Expand Down
8 changes: 2 additions & 6 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
@@ -1,13 +1,9 @@
# 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/openai/openai-node/actions/workflows/publish-npm.yml
# 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:

release:
types: [published]

jobs:
publish:
name: publish
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/release-doctor.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,5 @@ jobs:
run: |
bash ./bin/check-release-environment
env:
STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }}
NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN || secrets.NPM_TOKEN }}
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 "${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 organization 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 organization secrets")
fi
Expand Down

0 comments on commit 8b4009a

Please sign in to comment.