Skip to content

Add search using Typesense #396

Add search using Typesense

Add search using Typesense #396

name: Deploy
on:
pull_request:
push:
branches:
- master
jobs:
build:
runs-on: ubuntu-latest
permissions:
contents: read
deployments: write
pull-requests: write
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Setup Node.js
uses: actions/setup-node@v3
with:
node-version: 18
cache: npm
- name: Install Dependencies
run: npm ci
- name: Build
run: npm run build
env:
TYPESENSE_HOST: ${{ secrets.TYPESENSE_HOST }}
TYPESENSE_PORT: 443
TYPESENSE_PROTOCOL: https
TYPESENSE_SEARCH_API_KEY: ${{ secrets.TYPESENSE_SEARCH_API_KEY }}
- name: Publish to Cloudflare Pages
id: cloudflare-pages
uses: cloudflare/pages-action@v1
with:
apiToken: ${{ secrets.CLOUDFLARE_PAGES_API_TOKEN }}
accountId: ${{ secrets.CLOUDFLARE_ACCOUNT_ID }}
projectName: topper-docs
directory: build
- name: Index Docs in Typesense
if: github.ref == 'refs/heads/master'
run: npm run index
env:
TYPESENSE_API_KEY: ${{ secrets.TYPESENSE_API_KEY }}
TYPESENSE_HOST: ${{ secrets.TYPESENSE_HOST }}
TYPESENSE_PORT: 443
TYPESENSE_PROTOCOL: https
- name: Add Comment
uses: mshick/add-pr-comment@v2
with:
message: |
<span aria-hidden="true">🚀</span> Preview has been deployed.
| Name | Link |
|------ | ---- |
| <span aria-hidden="true">🔨</span> Commit SHA | ${{ github.sha }} |
| <span aria-hidden="true">🔍</span> Deploy log | ${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }} |
| <span aria-hidden="true">🚀</span> Preview URL | [${{ steps.cloudflare-pages.outputs.url }}](${{ steps.cloudflare-pages.outputs.url }}) |