Algolia #327
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: "Algolia" | |
| on: | |
| pull_request: | |
| types: | |
| - opened | |
| - synchronize | |
| - reopened | |
| paths: | |
| - "website/algolia/**" | |
| - "website/docusaurus.config.js" | |
| - "website/package.json" | |
| - "website/pnpm-lock.yaml" | |
| - ".github/workflows/algolia.yaml" | |
| workflow_run: | |
| workflows: ["Website Deploy Prod"] | |
| types: | |
| - completed | |
| branches: | |
| - main | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| validate: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: "website/.nvmrc" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Install Dependencies | |
| run: | | |
| cd website | |
| pnpm install --frozen-lockfile | |
| - name: Test Algolia crawler config | |
| run: | | |
| cd website | |
| pnpm run test:algolia | |
| - name: Validate deploy payload without upload | |
| run: | | |
| cd website | |
| pnpm run algolia:deploy:dry-run | |
| deploy: | |
| if: | | |
| (github.event_name == 'workflow_dispatch' && github.ref == 'refs/heads/main') || | |
| (github.event_name == 'workflow_run' && github.event.workflow_run.conclusion == 'success') | |
| needs: | |
| - validate | |
| runs-on: ubuntu-latest | |
| environment: | |
| name: algolia | |
| steps: | |
| - name: Checkout Repository | |
| uses: actions/checkout@de0fac2e4500dabe0009e67214ff5f5447ce83dd # v6.0.2 | |
| with: | |
| persist-credentials: false | |
| - name: Setup Node | |
| uses: actions/setup-node@v4 | |
| with: | |
| node-version-file: "website/.nvmrc" | |
| - name: Setup pnpm | |
| uses: pnpm/action-setup@v4 | |
| with: | |
| version: 9 | |
| - name: Install Dependencies | |
| run: | | |
| cd website | |
| pnpm install --frozen-lockfile | |
| - name: Deploy crawler config | |
| run: | | |
| cd website | |
| pnpm run algolia:deploy | |
| env: | |
| ALGOLIA_CRAWLER_ID: ${{ secrets.ALGOLIA_CRAWLER_ID }} | |
| ALGOLIA_CRAWLER_USER_ID: ${{ secrets.ALGOLIA_CRAWLER_USER_ID }} | |
| ALGOLIA_CRAWLER_API_KEY: ${{ secrets.ALGOLIA_CRAWLER_API_KEY }} | |
| ALGOLIA_CRAWLER_INDEXING_API_KEY: ${{ secrets.ALGOLIA_CRAWLER_INDEXING_API_KEY }} | |
| # Deploy script PATCHes the crawler config and PUTs index settings, then | |
| # POSTs /reindex. Order is critical: reindex must use the just-deployed | |
| # config, and the site must already be live on S3 (guaranteed by the | |
| # workflow_run trigger on Website Deploy Prod success). | |
| ALGOLIA_CRAWLER_REINDEX: "true" |