Skip to content

Commit

Permalink
Merge pull request #1885 from Urigo/feat/search-indexing
Browse files Browse the repository at this point in the history
feat(website): index doc pages in new search
  • Loading branch information
charlypoly committed May 23, 2022
2 parents fad5278 + de45c59 commit aa70956
Show file tree
Hide file tree
Showing 18 changed files with 765 additions and 73 deletions.
60 changes: 60 additions & 0 deletions .github/workflows/algolia-integrity.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
name: Algolia Integrity
on:
pull_request:
paths:
- 'website/**'
jobs:
algolia-records-check:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
with:
fetch-depth: 0
- name: Use Node 18
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'
- name: Install Dependencies
run: yarn --ignore-engines
working-directory: ./website

- name: Build Packages
run: yarn build
working-directory: ./website

- name: Algolia generate
run: yarn algolia-sync
working-directory: ./website
env:
ALGOLIA_DRY_RUN: true
SITE_URL: https://www.graphql-cli.com/

- name: Yarn build at root
run: yarn

- name: Prettier
run: yarn prettier -w website/algolia-lockfile.json

- name: Compare
run: git diff origin/${{ github.base_ref }}.. -- website/algolia-lockfile.json

- name: Diff to file
if: always()
id: diff_result
run: |
OUTPUT=$(git diff origin/${{ github.base_ref }}.. -- website/algolia-lockfile.json)
OUTPUT="${OUTPUT//'%'/'%25'}"
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
echo "::set-output name=result::$OUTPUT"
- name: Publish a message
if: always() && contains(steps.diff_result.outputs.result, 'diff')
uses: marocchino/sticky-pull-request-comment@v2
with:
message: |
```diff
${{ steps.diff_result.outputs.result }}
```
64 changes: 64 additions & 0 deletions .github/workflows/algolia-publish.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
name: Algolia Publish

on:
push:
branches:
- master

jobs:
algolia-push-records:
name: Push new records if changes
runs-on: ubuntu-latest
steps:
- name: Checkout Repo
uses: actions/checkout@v3

- name: Use Node
uses: actions/setup-node@v3
with:
node-version: 16
cache: 'yarn'

- name: Install Dependencies
run: yarn
working-directory: ./website

- name: Build Packages
run: yarn build
working-directory: ./website

- name: Algolia push
run: yarn algolia-sync
working-directory: ./website
env:
ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
ALGOLIA_ADMIN_API_KEY: ${{ secrets.ALGOLIA_ADMIN_API_KEY }}
ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }}
SITE_URL: https://www.graphql-cli.com/

- name: Yarn build at root
run: yarn

- name: Prettier
run: yarn prettier -w website/algolia-lockfile.json

- name: Compare
run: git diff website/algolia-lockfile.json

- name: Diff to file
if: always()
id: diff_result
run: |
OUTPUT=$(git diff website/algolia-lockfile.json)
OUTPUT="${OUTPUT//'%'/'%25'}"
OUTPUT="${OUTPUT//$'\n'/'%0A'}"
OUTPUT="${OUTPUT//$'\r'/'%0D'}"
echo "::set-output name=result::$OUTPUT"
- name: Commit algolia-lockfile.json
if: always() && contains(steps.diff_result.outputs.result, 'diff')
uses: EndBug/add-and-commit@v9
with:
commit: website/algolia-lockfile.json
message: Update algolia-lockfile.json
default_author: github_actions
3 changes: 3 additions & 0 deletions .github/workflows/website.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,3 +35,6 @@ jobs:
run: yarn deploy:website
env:
GIT_USER: ${{github.actor}}
NEXT_PUBLIC_ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }}
NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY: a5522203ca95675199cc21edf09e6d75
NEXT_PUBLIC_ALGOLIA_INDEX_NAME: ${{ secrets.ALGOLIA_INDEX_NAME }}
224 changes: 224 additions & 0 deletions website/algolia-lockfile.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,224 @@
[
{
"objectID": "cli-codegen",
"headings": [],
"toc": [],
"content": "-",
"url": "https://www.graphql-cli.com/codegen",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "codegen"],
"source": "CLI",
"title": "codegen",
"type": "Documentation"
},
{
"objectID": "cli-coverage",
"headings": [],
"toc": [],
"content": "-",
"url": "https://www.graphql-cli.com/coverage",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "coverage"],
"source": "CLI",
"title": "coverage",
"type": "Documentation"
},
{
"objectID": "cli-custom-commands",
"headings": [
"Writing your own commands",
"Testing your plugin locally",
"Loading GraphQL Schema",
"Error Handling"
],
"toc": [
{
"children": [
{
"children": [
{
"children": [],
"title": "Getting Started",
"anchor": "getting-started"
}
],
"title": "TL;DR",
"anchor": "tldr"
}
],
"title": "Writing your own commands",
"anchor": "writing-your-own-commands"
},
{
"children": [],
"title": "Testing your plugin locally",
"anchor": "testing-your-plugin-locally"
},
{
"children": [],
"title": "Loading GraphQL Schema",
"anchor": "loading-graphql-schema"
},
{
"children": [],
"title": "Error Handling",
"anchor": "error-handling"
}
],
"content": "-",
"url": "https://www.graphql-cli.com/custom-commands",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "Custom commands"],
"source": "CLI",
"title": "Custom commands",
"type": "Documentation"
},
{
"objectID": "cli-diff",
"headings": [],
"toc": [],
"content": "-",
"url": "https://www.graphql-cli.com/diff",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "diff"],
"source": "CLI",
"title": "diff",
"type": "Documentation"
},
{
"objectID": "cli-discover",
"headings": [],
"toc": [],
"content": "-",
"url": "https://www.graphql-cli.com/discover",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "discover"],
"source": "CLI",
"title": "discover",
"type": "Documentation"
},
{
"objectID": "cli-generate",
"headings": [],
"toc": [],
"content": "-",
"url": "https://www.graphql-cli.com/generate",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "generate"],
"source": "CLI",
"title": "generate",
"type": "Documentation"
},
{
"objectID": "cli-init",
"headings": [],
"toc": [],
"content": "-",
"url": "https://www.graphql-cli.com/init",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "init"],
"source": "CLI",
"title": "init",
"type": "Documentation"
},
{
"objectID": "cli-introduction",
"headings": [],
"toc": [],
"content": "-",
"url": "https://www.graphql-cli.com/introduction",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "Introduction"],
"source": "CLI",
"title": "Introduction",
"type": "Documentation"
},
{
"objectID": "cli-introspect",
"headings": [],
"toc": [],
"content": "-",
"url": "https://www.graphql-cli.com/introspect",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "introspect"],
"source": "CLI",
"title": "introspect",
"type": "Documentation"
},
{
"objectID": "cli-migration",
"headings": ["Migration from GraphQL CLI 3.x or older"],
"toc": [
{
"children": [
{
"children": [
{
"children": [],
"title": "Update your configuration file",
"anchor": "update-your-configuration-file"
},
{
"children": [],
"title": "Comparison of old commands",
"anchor": "comparison-of-old-commands"
},
{
"children": [],
"title": "Special Notes for Prisma users",
"anchor": "special-notes-for-prisma-users"
}
],
"title": "Install the new version",
"anchor": "install-the-new-version"
}
],
"title": "Migration from GraphQL CLI 3.x or older",
"anchor": "migration-from-graphql-cli-3x-or-older"
}
],
"content": "-",
"url": "https://www.graphql-cli.com/migration",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "Migration"],
"source": "CLI",
"title": "Migration",
"type": "Documentation"
},
{
"objectID": "cli-serve",
"headings": [],
"toc": [],
"content": "-",
"url": "https://www.graphql-cli.com/serve",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "serve"],
"source": "CLI",
"title": "serve",
"type": "Documentation"
},
{
"objectID": "cli-similar",
"headings": [],
"toc": [],
"content": "-",
"url": "https://www.graphql-cli.com/similar",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "similar"],
"source": "CLI",
"title": "similar",
"type": "Documentation"
},
{
"objectID": "cli-validate",
"headings": [],
"toc": [],
"content": "-",
"url": "https://www.graphql-cli.com/validate",
"domain": "https://www.graphql-cli.com/",
"hierarchy": ["CLI", "validate"],
"source": "CLI",
"title": "validate",
"type": "Documentation"
}
]
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
7 changes: 7 additions & 0 deletions website/docusaurus.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,13 @@ module.exports = {
},
},
scripts: ['/js/light-mode-by-default.js'],
customFields: {
algolia: {
appId: process.env.NEXT_PUBLIC_ALGOLIA_APP_ID,
searchApiKey: process.env.NEXT_PUBLIC_ALGOLIA_SEARCH_API_KEY,
indexName: process.env.NEXT_PUBLIC_ALGOLIA_INDEX_NAME,
},
},
presets: [
[
require.resolve('@docusaurus/preset-classic'),
Expand Down
4 changes: 3 additions & 1 deletion website/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,12 @@
"start": "docusaurus start",
"build": "docusaurus build",
"swizzle": "docusaurus swizzle",
"deploy": "docusaurus deploy"
"deploy": "docusaurus deploy",
"algolia-sync": "ts-node scripts/algolia-ci.ts"
},
"dependencies": {
"@docusaurus/core": "^2.0.0-beta.0",
"@guild-docs/algolia": "0.0.6-alpha-1bcf597.0",
"@docusaurus/preset-classic": "^2.0.0-beta.0",
"clsx": "^1.1.1",
"react": "^17.0.0",
Expand Down
Loading

0 comments on commit aa70956

Please sign in to comment.