Skip to content

Build and Deploy Docs to Github Pages #234

Build and Deploy Docs to Github Pages

Build and Deploy Docs to Github Pages #234

Workflow file for this run

name: Build and Deploy Docs to Github Pages
on:
workflow_dispatch:
release:
types: [created]
schedule:
- cron: '0 9 * * 3' # Every 9AM on Wednesday
env:
CI: true
NEXT_PUBLIC_ALGOLIA_APPLICATION_ID: ${{secrets.NEXT_PUBLIC_ALGOLIA_APPLICATION_ID}}
ALGOLIA_ADMIN_API_KEY: ${{secrets.ALGOLIA_ADMIN_API_KEY}}
NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY: ${{secrets.NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY}}
permissions:
issues: read
pull-requests: read
jobs:
build:
permissions:
contents: write
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: false
- name: ✍🏻 Setup node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: 📥 Install deps
run: npm ci --legacy-peer-deps
- name: 👷‍♂️ Build
run: npm run build
- name: 🚀 Deploy
uses: JamesIves/[email protected]
with:
branch: gh-pages # The branch the action should deploy to.
folder: docs/out # The folder the action should deploy.
clean: true # Automatically remove deleted files from the deploy branch
algolia:
runs-on: ubuntu-latest
defaults:
run:
working-directory: ./docs
steps:
- name: 🛑 Cancel Previous Runs
uses: styfle/[email protected]
- name: ⬇️ Checkout repo
uses: actions/checkout@v4
with:
persist-credentials: false
- name: ✍🏻 Setup node
uses: actions/setup-node@v4
with:
node-version: 20.x
- name: 📥 Install deps
run: npm ci --legacy-peer-deps
- name: Install jq
run: sudo apt-get install -y jq
- name: 🔎 Send to Algolia
uses: actions/checkout@v4
- name: Get the content of algolia.json as config
id: algolia_config
run: echo "::set-output name=config::$(cat algolia.json | jq -r tostring)"
- name: Push indices to Algolia
uses: signcl/docsearch-scraper-action@master
env:
APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }}
API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
CONFIG: ${{ steps.algolia_config.outputs.config }}