Skip to content

Index TED Developer Docs #628

Index TED Developer Docs

Index TED Developer Docs #628

Workflow file for this run

name: Index TED Developer Docs
on:
workflow_dispatch
#workflow_dispatch:
#schedule:
# * is a special character in YAML so you have to quote this string
# - cron: '0 4 * * *'
env:
JOBS_REPO: github.com/OP-TED/OP-TED.github.io
BUILD_JOB: Build and publish TED Developer Docs
INDEX_JOB: Index TED Developer Docs
jobs:
delete_site_index:
name: "Delete existing site index"
runs-on: [ubuntu-latest]
steps:
- name: Download Algolia CLI
run: 'mkdir -p algolia-cli; curl -L "https://github.com/algolia/cli/releases/download/v1.6.11/algolia_1.6.11_linux_386.tar.gz"|tar xpz -C algolia-cli --strip-components=1'
- name: Create Algolia profile
run: ./algolia-cli/algolia profile add --name ted-profile --app-id ${{ secrets.ALGOLIA_APPLICATION_ID }} --api-key ${{ secrets.ALGOLIA_API_KEY }} --default
- name: Delete index ${{ secrets.ALGOLIA_INDEX_NAME }}
run: |
./algolia-cli/algolia indices list; \
if echo $(./algolia-cli/algolia indices list)|grep -q '${{ secrets.ALGOLIA_INDEX_NAME }}'; then \
./algolia-cli/algolia indices delete -y ${{ secrets.ALGOLIA_INDEX_NAME }}; \
fi;
index_site:
name: "Index site using Docsearch Crawler"
needs: delete_site_index
runs-on: [ubuntu-latest]
steps:
- name: Checkout
uses: actions/checkout@v4
- name: Save docsearch-config.json
run: |
echo '${{ env.docsearch_config }}' > docsearch-config.json
- name: Get the content of docsearch-config.json as config
id: docsearch_config
run: echo "docsearch_config=$(cat config/docsearch-config.json | jq -r tostring)" >> ${GITHUB_ENV}
- name: Run DocSearch Scraper
run: |
docker run -e "APPLICATION_ID=${{ secrets.ALGOLIA_APPLICATION_ID }}" -e "API_KEY=${{ secrets.ALGOLIA_API_KEY }}" algolia/docsearch-scraper