From 914b1d1657d4eb711dd24997d36100f62434c353 Mon Sep 17 00:00:00 2001 From: Francis Chartrand Date: Wed, 27 Nov 2024 08:50:20 -0500 Subject: [PATCH 1/2] feat(docusaurus): add algolia docsearch --- website/.env.example | 3 +++ website/.gitignore | 1 + website/docusaurus.config.ts | 10 ++++++++++ website/package.json | 1 + website/yarn.lock | 8 ++++++++ 5 files changed, 23 insertions(+) create mode 100644 website/.env.example diff --git a/website/.env.example b/website/.env.example new file mode 100644 index 00000000..b63acce5 --- /dev/null +++ b/website/.env.example @@ -0,0 +1,3 @@ +ALGOLIA_APP_ID="XYZ" +ALGOLIA_API_KEY="XYZ" +ALGOLIA_INDEX_NAME="beta-wazo-platform" diff --git a/website/.gitignore b/website/.gitignore index 9985a122..ea9cc8d6 100644 --- a/website/.gitignore +++ b/website/.gitignore @@ -10,6 +10,7 @@ # Misc .DS_Store +.env .env.local .env.development.local .env.test.local diff --git a/website/docusaurus.config.ts b/website/docusaurus.config.ts index a8b33736..07ca6dcb 100644 --- a/website/docusaurus.config.ts +++ b/website/docusaurus.config.ts @@ -1,6 +1,7 @@ import type * as Preset from '@docusaurus/preset-classic'; import type { Config } from '@docusaurus/types'; import { themes as prismThemes } from 'prism-react-renderer'; +import 'dotenv/config'; import REDIRECTS from './redirects'; const config: Config = { @@ -146,6 +147,15 @@ const config: Config = { mermaid: { theme: { light: 'neutral', dark: 'dark' }, }, + ...(process.env.ALGOLIA_APP_ID + ? { + algolia: { + appId: process.env.ALGOLIA_APP_ID, + apiKey: process.env.ALGOLIA_API_KEY, + indexName: process.env.ALGOLIA_INDEX_NAME, + }, + } + : {}), } satisfies Preset.ThemeConfig, plugins: [ [ diff --git a/website/package.json b/website/package.json index 2c116a73..c5ad899b 100644 --- a/website/package.json +++ b/website/package.json @@ -29,6 +29,7 @@ "@iconify/react": "^5.0.2", "@mdx-js/react": "^3.1.0", "clsx": "^2.1.1", + "dotenv": "^16.4.5", "prism-react-renderer": "^2.4.0", "react": "^18.3.1", "react-dom": "^18.3.1" diff --git a/website/yarn.lock b/website/yarn.lock index 15734d07..f1e73665 100644 --- a/website/yarn.lock +++ b/website/yarn.lock @@ -7749,6 +7749,13 @@ __metadata: languageName: node linkType: hard +"dotenv@npm:^16.4.5": + version: 16.4.5 + resolution: "dotenv@npm:16.4.5" + checksum: 10c0/48d92870076832af0418b13acd6e5a5a3e83bb00df690d9812e94b24aff62b88ade955ac99a05501305b8dc8f1b0ee7638b18493deb6fe93d680e5220936292f + languageName: node + linkType: hard + "duplexer@npm:^0.1.2": version: 0.1.2 resolution: "duplexer@npm:0.1.2" @@ -14955,6 +14962,7 @@ __metadata: "@lottiefiles/react-lottie-player": "npm:^3.5.4" "@mdx-js/react": "npm:^3.1.0" clsx: "npm:^2.1.1" + dotenv: "npm:^16.4.5" prism-react-renderer: "npm:^2.4.0" react: "npm:^18.3.1" react-dom: "npm:^18.3.1" From 5edf0b395595b458fee804e5b814960bbad5cd6b Mon Sep 17 00:00:00 2001 From: Francis Chartrand Date: Wed, 27 Nov 2024 10:51:50 -0500 Subject: [PATCH 2/2] build(actions): use env variable for algolia search --- .github/workflows/deploy.yml | 4 ++++ .github/workflows/test-deploy.yml | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/.github/workflows/deploy.yml b/.github/workflows/deploy.yml index 6a3d0197..97b01e77 100644 --- a/.github/workflows/deploy.yml +++ b/.github/workflows/deploy.yml @@ -19,6 +19,10 @@ jobs: cache: yarn - name: Install & build + env: + ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} + ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} + ALGOLIA_INDEX_NAME: ${{ vars.ALGOLIA_INDEX_NAME }} run: | corepack enable cd website diff --git a/.github/workflows/test-deploy.yml b/.github/workflows/test-deploy.yml index 0652f3d0..9e6bd15e 100644 --- a/.github/workflows/test-deploy.yml +++ b/.github/workflows/test-deploy.yml @@ -19,6 +19,10 @@ jobs: cache: yarn - name: Install & build + env: + ALGOLIA_APP_ID: ${{ secrets.ALGOLIA_APP_ID }} + ALGOLIA_API_KEY: ${{ secrets.ALGOLIA_API_KEY }} + ALGOLIA_INDEX_NAME: ${{ vars.ALGOLIA_INDEX_NAME }} run: | corepack enable cd website