Generate Embeddings for Search #6
This file contains 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: Generate Embeddings for Search | |
on: | |
push: | |
branches: | |
- master | |
paths: | |
- '.github/workflows/search.yml' | |
- 'supabase/migrations/**' | |
- 'apps/docs/**' | |
- 'spec/**' | |
workflow_dispatch: | |
inputs: | |
refresh: | |
description: 'Refresh all pages' | |
required: false | |
type: boolean | |
schedule: | |
- cron: '0 0 * * *' | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
env: | |
OPENAI_KEY: ${{ secrets.OPENAI_KEY }} | |
IECHOR_ACCESS_TOKEN: ${{ secrets.IECHOR_ACCESS_TOKEN }} | |
PROJECT_ID: ${{ secrets.SEARCH_IECHOR_PROJECT_ID }} | |
NEXT_PUBLIC_IECHOR_URL: ${{ secrets.SEARCH_IECHOR_URL }} | |
IECHOR_SERVICE_ROLE_KEY: ${{ secrets.SEARCH_IECHOR_SERVICE_ROLE_KEY }} | |
IECHOR_DB_PASSWORD: ${{ secrets.SEARCH_IECHOR_DB_PASSWORD }} | |
SEARCH_GITHUB_APP_ID: ${{ secrets.SEARCH_GITHUB_APP_ID }} | |
SEARCH_GITHUB_APP_INSTALLATION_ID: ${{ secrets.SEARCH_GITHUB_APP_INSTALLATION_ID }} | |
SEARCH_GITHUB_APP_PRIVATE_KEY: ${{ secrets.SEARCH_GITHUB_APP_PRIVATE_KEY }} | |
steps: | |
- name: Check out repo | |
uses: actions/checkout@v3 | |
- name: Setup node | |
uses: actions/setup-node@v3 | |
with: | |
node-version: 18 | |
- name: Download dependencies | |
run: npm ci | |
- name: Link iEchor project | |
run: npx iechor link --project-ref $PROJECT_ID | |
- name: Run migrations | |
run: npx iechor db push | |
- name: Update embeddings | |
working-directory: ./apps/docs | |
if: ${{ !inputs.refresh }} | |
run: npm run embeddings | |
- name: Refresh embeddings | |
working-directory: ./apps/docs | |
if: ${{ inputs.refresh }} | |
run: npm run embeddings:refresh |