Skip to content

Commit

Permalink
Merge pull request #516 from openai/dev/atty/manual-deno-workflow
Browse files Browse the repository at this point in the history
[github] Add a manual workflow to publish openai-deno-build
  • Loading branch information
athyuttamre committed Nov 19, 2023
2 parents 049ce6f + 4346ba6 commit 6e2df3d
Show file tree
Hide file tree
Showing 3 changed files with 46 additions and 11 deletions.
44 changes: 44 additions & 0 deletions .github/workflows/publish-deno.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
# 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:

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

steps:
- 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'

- uses: actions/checkout@v3

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

- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Install dependencies
run: |
yarn install
- name: Publish to Deno
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
11 changes: 1 addition & 10 deletions .github/workflows/publish-npm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ jobs:
publish:
name: publish
runs-on: ubuntu-latest
environment: publish

steps:
- uses: actions/checkout@v3
Expand All @@ -17,11 +18,6 @@ jobs:
with:
node-version: '16'

- name: Set up Deno
uses: denoland/setup-deno@v1
with:
deno-version: v1.x

- name: Install dependencies
run: |
yarn install
Expand All @@ -31,8 +27,3 @@ jobs:
bash ./bin/publish-npm
env:
NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN || secrets.NPM_TOKEN }}

- name: Publish to Deno
run: |
bash ./scripts/git-publish-deno.sh
env: {}
2 changes: 1 addition & 1 deletion scripts/git-publish-deno.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env bash
set -exuo pipefail

# This script pushes the contents of the `deno`` directory to the `deno` branch,
# This script pushes the contents of the `deno` directory to the `deno` branch,
# and creates a `vx.x.x-deno` tag, so that Deno users can
# import OpenAI from "https://raw.githubusercontent.com/openai/openai-node/vx.x.x-deno/mod.ts"

Expand Down

0 comments on commit 6e2df3d

Please sign in to comment.