diff --git a/.github/workflows/publish-deno.yml b/.github/workflows/publish-deno.yml new file mode 100644 index 000000000..1b264b39e --- /dev/null +++ b/.github/workflows/publish-deno.yml @@ -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 diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 15f7d5af3..f4e38daca 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -8,6 +8,7 @@ jobs: publish: name: publish runs-on: ubuntu-latest + environment: publish steps: - uses: actions/checkout@v3 @@ -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 @@ -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: {} diff --git a/scripts/git-publish-deno.sh b/scripts/git-publish-deno.sh index 90855bfb8..4098994f3 100755 --- a/scripts/git-publish-deno.sh +++ b/scripts/git-publish-deno.sh @@ -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"