Skip to content

Build the site, update Algolia's search index, and regenerate the sitemap #537

Build the site, update Algolia's search index, and regenerate the sitemap

Build the site, update Algolia's search index, and regenerate the sitemap #537

name: postbuild-scripts
run-name: Build the site, update Algolia's search index, and regenerate the sitemap
on:
push:
branches:
- "main"
# This allows a subsequently queued workflow run to interrupt previous runs
concurrency:
group: "${{ github.workflow }} @ ${{ github.event.pull_request.head.label || github.head_ref || github.ref }}"
cancel-in-progress: true
jobs:
build-search-index:
runs-on: ubuntu-latest
name: Build Algolia search index
environment: Build Search Index
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Setup node, build the site and search index afterwards
uses: actions/setup-node@v3
with:
node-version: "20"
- run: npm install
- run: npm run export
- name: Run build-search-index script
run: node ./scripts/build-search-index.js
env:
ALGOLIA_SECRET: ${{ secrets.ALGOLIA_SECRET }}
build-sitemap:
runs-on: ubuntu-latest
name: Build sitemap
steps:
- name: Checkout the repo
uses: actions/checkout@v3
- name: Setup node, build the site, and generate the sitemap
id: sitemap
uses: actions/setup-node@v3
with:
node-version: "20"
- run: npm install
- run: npm run export
- run: npm run sitemap
- name: Create Pull Request
uses: peter-evans/create-pull-request@v3
with:
title: "Automated sitemap update"
body: >
Sitemap updated by the [generate-sitemap](https://github.com/cicirello/generate-sitemap)
GitHub action. Automated pull-request generated by the
[create-pull-request](https://github.com/peter-evans/create-pull-request) GitHub action.