Skip to content

feat: wire up Algolia DocSearch + document Secrets behavior accurately #35

feat: wire up Algolia DocSearch + document Secrets behavior accurately

feat: wire up Algolia DocSearch + document Secrets behavior accurately #35

Workflow file for this run

name: Deploy to GitHub Pages
on:
push:
branches:
- main
jobs:
deploy:
name: Deploy to GitHub Pages
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: actions/setup-node@v4
with:
node-version: 20
cache: yarn
- name: Install dependencies
run: yarn install --frozen-lockfile
- name: Build website
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_SEARCH_KEY: ${{ secrets.ALGOLIA_SEARCH_KEY }}
ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }}
run: yarn build
# Popular action to deploy to GitHub Pages:
# Docs: https://github.com/peaceiris/actions-gh-pages#%EF%B8%8F-docusaurus
- name: Deploy to GitHub Pages
uses: peaceiris/actions-gh-pages@v3
with:
github_token: ${{ secrets.GITHUB_TOKEN }}
# Build output to publish to the `gh-pages` branch:
publish_dir: ./build
# The following lines assign commit authorship to the official
# GH-Actions bot for deploys to `gh-pages` branch:
# https://github.com/actions/checkout/issues/13#issuecomment-724415212
# The GH actions bot is used by default if you didn't specify the two fields.
# You can swap them out with your own user credentials.
user_name: github-actions[bot]
user_email: 41898282+github-actions[bot]@users.noreply.github.com
index:
name: Refresh Algolia index
# Runs after deploy so the scraper sees the freshly-published site.
needs: deploy
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- name: Run DocSearch scraper
env:
APPLICATION_ID: ${{ secrets.ALGOLIA_APP_ID }}
API_KEY: ${{ secrets.ALGOLIA_ADMIN_KEY }}
run: |
# Wait a moment for GitHub Pages to publish the new build.
sleep 30
docker run --rm \
-e APPLICATION_ID \
-e API_KEY \
-e "CONFIG=$(cat docsearch-config.json)" \
algolia/docsearch-scraper