From 676ba7036ec541aa89b8db8d97160b9f804ea51e Mon Sep 17 00:00:00 2001 From: Stainless Bot Date: Wed, 14 Feb 2024 20:16:25 +0000 Subject: [PATCH] chore(ci): move github release logic to github app --- .github/workflows/create-releases.yml | 64 --------------------------- .github/workflows/publish-deno.yml | 8 +++- .github/workflows/publish-npm.yml | 8 +++- .github/workflows/release-doctor.yml | 1 - bin/check-release-environment | 4 -- 5 files changed, 12 insertions(+), 73 deletions(-) delete mode 100644 .github/workflows/create-releases.yml diff --git a/.github/workflows/create-releases.yml b/.github/workflows/create-releases.yml deleted file mode 100644 index 7ecd6282a..000000000 --- a/.github/workflows/create-releases.yml +++ /dev/null @@ -1,64 +0,0 @@ -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 diff --git a/.github/workflows/publish-deno.yml b/.github/workflows/publish-deno.yml index 578b592b3..38d2a69b4 100644 --- a/.github/workflows/publish-deno.yml +++ b/.github/workflows/publish-deno.yml @@ -1,9 +1,13 @@ -# 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 +# 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 name: Publish Deno on: workflow_dispatch: + release: + types: [published] + jobs: publish: name: publish diff --git a/.github/workflows/publish-npm.yml b/.github/workflows/publish-npm.yml index 2258ec560..96e0a6c48 100644 --- a/.github/workflows/publish-npm.yml +++ b/.github/workflows/publish-npm.yml @@ -1,9 +1,13 @@ -# 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 +# 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 name: Publish NPM on: workflow_dispatch: + release: + types: [published] + jobs: publish: name: publish diff --git a/.github/workflows/release-doctor.yml b/.github/workflows/release-doctor.yml index b640869d0..819ef9f8e 100644 --- a/.github/workflows/release-doctor.yml +++ b/.github/workflows/release-doctor.yml @@ -19,5 +19,4 @@ jobs: run: | bash ./bin/check-release-environment env: - STAINLESS_API_KEY: ${{ secrets.STAINLESS_API_KEY }} NPM_TOKEN: ${{ secrets.OPENAI_NPM_TOKEN || secrets.NPM_TOKEN }} diff --git a/bin/check-release-environment b/bin/check-release-environment index fdd847176..69bd03ea6 100644 --- a/bin/check-release-environment +++ b/bin/check-release-environment @@ -2,10 +2,6 @@ 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