feat: update API specifications from internal repo (#122) #36
  
    
      This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
      Learn more about bidirectional Unicode characters
    
  
  
    
  | name: Update OpenAI Vector Store | |
| on: | |
| push: | |
| branches: [main] | |
| paths: | |
| - "openapi.yml" | |
| # - "asyncapi.yml" | |
| workflow_dispatch: | |
| inputs: | |
| force_update: | |
| description: "Force update all files regardless of changes" | |
| required: false | |
| default: false | |
| type: boolean | |
| jobs: | |
| update-vector-store: | |
| runs-on: ubuntu-latest | |
| env: | |
| AWS_ACCESS_KEY_ID: ${{ secrets.TIGRIS_ACCESS_KEY_ID }} | |
| AWS_ENDPOINT_URL: ${{ secrets.TIGRIS_ENDPOINT_URL }} | |
| AWS_REGION: ${{ secrets.TIGRIS_REGION }} | |
| AWS_SECRET_ACCESS_KEY: ${{ secrets.TIGRIS_SECRET_ACCESS_KEY }} | |
| BUCKET_NAME: ${{ secrets.TIGRIS_BUCKET_NAME }} | |
| steps: | |
| - name: Checkout repository | |
| uses: actions/checkout@v4 | |
| with: | |
| fetch-depth: 0 | |
| token: ${{ secrets.GITHUB_TOKEN }} | |
| - name: Setup Node.js | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version: "22" | |
| - name: Install AWS CLI v2 | |
| run: | | |
| curl -sL "https://awscli.amazonaws.com/awscli-exe-linux-x86_64.zip" -o "awscliv2.zip" | |
| unzip -q awscliv2.zip | |
| sudo ./aws/install --update | |
| rm -rf awscliv2.zip aws/ | |
| aws --version | |
| - name: Create .deepgram directory | |
| run: mkdir -p .deepgram/metadata | |
| - name: Download previous vectorstore metadata from S3 | |
| continue-on-error: true | |
| run: | | |
| echo "Downloading metadata from S3 path: s3://${{ env.BUCKET_NAME }}/${{ github.repository }}/.deepgram/metadata/vectorstore_metadata.json" | |
| aws s3 cp \ | |
| --endpoint-url "${{ env.AWS_ENDPOINT_URL }}" \ | |
| "s3://${{ env.BUCKET_NAME }}/${{ github.repository }}/.deepgram/metadata/vectorstore_metadata.json" \ | |
| ./.deepgram/metadata/vectorstore_metadata.json \ | |
| --quiet || true | |
| - name: Verify metadata download | |
| run: | | |
| if [ -f .deepgram/metadata/vectorstore_metadata.json ]; then | |
| echo "✅ Successfully downloaded metadata from S3 for repository: ${{ github.repository }}" | |
| echo "File contents preview:" | |
| head -20 .deepgram/metadata/vectorstore_metadata.json || true | |
| else | |
| echo "⚠️ No existing metadata found in S3 for repository: ${{ github.repository }} - will start fresh" | |
| fi | |
| - name: Create output directories | |
| run: mkdir -p tmp/openapi tmp/asyncapi | |
| - name: Generate OpenAPI documentation with Deepgram CLI | |
| run: | | |
| npx -y @deepgram/deepdown-cli@latest build openapi.yml \ | |
| .deepgram/openapi.deepdown -o tmp/openapi/ --resolve-refs --resolve-security | |
| # - name: Generate AsyncAPI documentation with Deepgram CLI | |
| # run: | | |
| # npx -y @deepgram/deepdown-cli@latest build asyncapi.yml \ | |
| # .deepgram/asyncapi.deepdown -o tmp/asyncapi/ --resolve-refs --resolve-security | |
| - name: Make vectorize script executable | |
| run: chmod +x .deepgram/vectorize | |
| - name: Upload all files to Vector Store | |
| run: | | |
| node .deepgram/vectorize tmp/ | |
| env: | |
| CI: true | |
| OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY_VECTOR_MGMT }} | |
| - name: Upload vectorize metadata to S3 | |
| if: always() && hashFiles('.deepgram/metadata/vectorstore_metadata.json') != '' | |
| run: | | |
| echo "Uploading metadata to S3 path: s3://${{ env.BUCKET_NAME }}/${{ github.repository }}/.deepgram/metadata/vectorstore_metadata.json" | |
| aws s3 cp \ | |
| --endpoint-url "${{ env.AWS_ENDPOINT_URL }}" \ | |
| ./.deepgram/metadata/vectorstore_metadata.json \ | |
| "s3://${{ env.BUCKET_NAME }}/${{ github.repository }}/.deepgram/metadata/vectorstore_metadata.json" \ | |
| --quiet |