From c6781b3c2b059a2103e7d82fa3cf2df0156d8bed Mon Sep 17 00:00:00 2001 From: Michael Stettenbenz Date: Wed, 26 Jul 2023 18:45:07 -0400 Subject: [PATCH 1/4] DO-4165 initial env based pipeline config --- .github/workflows/build-and-deploy.yml | 21 ++++++++++++++ algolia.json | 39 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 algolia.json diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index ac65ef50..ff68eaca 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -8,6 +8,7 @@ on: jobs: build_and_deploy: runs-on: ubuntu-latest + environment: dev steps: - name: Checkout code @@ -34,3 +35,23 @@ jobs: - name: Sync to S3 run: aws s3 sync build/ s3://device42-docs-website-content-dev --size-only --delete + - name: Invalidate CF cache + run: | + INVAL_ID=$(aws cloudfront create-invalidation --distribution-id ${{ env.CF_DISTRO }} --paths "*" | jq -r .Invalidation.Id ) + aws cloudfront wait invalidation-completed --distribution-id ${{ env.CF_DISTRO }} --id $INVAL_ID + + - name: Setup Algolia Config + id: algolia_config + run: | + sed -i 's//${{ env.ALGOLIA_INDEX }}/g' algolia.json + sed -i 's//${{ env.FQDN }}/g' algolia.json + echo "::set-output name=config::$(cat algolia.json | jq -r tostring)" + + - name: Run Algolia Reindex + uses: signcl/docsearch-scraper-action@master + env: + APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }} + API_KEY: ${{ secrets.ALGOLIA_API_KEY }} + CONFIG: ${{ steps.algolia_config.outputs.config }} + + diff --git a/algolia.json b/algolia.json new file mode 100644 index 00000000..82cb595f --- /dev/null +++ b/algolia.json @@ -0,0 +1,39 @@ +{ + "index_name": "", + "start_urls": ["https://"], + "sitemap_urls": ["https:///sitemap.xml"], + "ignoreNoIndex": "true", + "selectors": { + "lvl0": { + "selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]", + "type": "xpath", + "global": true, + "default_value": "Documentation" + }, + "lvl1": "header h1", + "lvl2": "article h2", + "lvl3": "article h3", + "lvl4": "article h4", + "lvl5": "article h5, article td:first-child", + "lvl6": "article h6", + "text": "article p, article li, article td:last-child" + }, + "strip_chars": " .,;:#", + "custom_settings": { + "separatorsToIndex": "_", + "attributesForFaceting": [ + "language", + "version", + "type", + "docusaurus_tag" + ], + "attributesToRetrieve": [ + "hierarchy", + "content", + "anchor", + "url", + "url_without_anchor", + "type" + ] + } +} From 86542e1ad8063bc8187e5a9ea8aba30a752c38f8 Mon Sep 17 00:00:00 2001 From: mikeD42 <62258801+mikeD42@users.noreply.github.com> Date: Thu, 27 Jul 2023 17:20:10 -0400 Subject: [PATCH 2/4] DO-4165 invalidation syntax error Fixing path syntax for invalidation call --- .github/workflows/build-and-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index ff68eaca..71c23378 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -37,7 +37,7 @@ jobs: - name: Invalidate CF cache run: | - INVAL_ID=$(aws cloudfront create-invalidation --distribution-id ${{ env.CF_DISTRO }} --paths "*" | jq -r .Invalidation.Id ) + INVAL_ID=$(aws cloudfront create-invalidation --distribution-id ${{ env.CF_DISTRO }} --paths "/*" | jq -r .Invalidation.Id ) aws cloudfront wait invalidation-completed --distribution-id ${{ env.CF_DISTRO }} --id $INVAL_ID - name: Setup Algolia Config From 2056e5bee828692e5e7eafb5e949328415d5ecbd Mon Sep 17 00:00:00 2001 From: Michael Stettenbenz Date: Wed, 26 Jul 2023 18:45:07 -0400 Subject: [PATCH 3/4] DO-4165 initial env based pipeline config --- .github/workflows/build-and-deploy.yml | 21 ++++++++++++++ algolia.json | 39 ++++++++++++++++++++++++++ 2 files changed, 60 insertions(+) create mode 100644 algolia.json diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index ac65ef50..ff68eaca 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -8,6 +8,7 @@ on: jobs: build_and_deploy: runs-on: ubuntu-latest + environment: dev steps: - name: Checkout code @@ -34,3 +35,23 @@ jobs: - name: Sync to S3 run: aws s3 sync build/ s3://device42-docs-website-content-dev --size-only --delete + - name: Invalidate CF cache + run: | + INVAL_ID=$(aws cloudfront create-invalidation --distribution-id ${{ env.CF_DISTRO }} --paths "*" | jq -r .Invalidation.Id ) + aws cloudfront wait invalidation-completed --distribution-id ${{ env.CF_DISTRO }} --id $INVAL_ID + + - name: Setup Algolia Config + id: algolia_config + run: | + sed -i 's//${{ env.ALGOLIA_INDEX }}/g' algolia.json + sed -i 's//${{ env.FQDN }}/g' algolia.json + echo "::set-output name=config::$(cat algolia.json | jq -r tostring)" + + - name: Run Algolia Reindex + uses: signcl/docsearch-scraper-action@master + env: + APPLICATION_ID: ${{ secrets.ALGOLIA_APPLICATION_ID }} + API_KEY: ${{ secrets.ALGOLIA_API_KEY }} + CONFIG: ${{ steps.algolia_config.outputs.config }} + + diff --git a/algolia.json b/algolia.json new file mode 100644 index 00000000..82cb595f --- /dev/null +++ b/algolia.json @@ -0,0 +1,39 @@ +{ + "index_name": "", + "start_urls": ["https://"], + "sitemap_urls": ["https:///sitemap.xml"], + "ignoreNoIndex": "true", + "selectors": { + "lvl0": { + "selector": "(//ul[contains(@class,'menu__list')]//a[contains(@class, 'menu__link menu__link--sublist menu__link--active')]/text() | //nav[contains(@class, 'navbar')]//a[contains(@class, 'navbar__link--active')]/text())[last()]", + "type": "xpath", + "global": true, + "default_value": "Documentation" + }, + "lvl1": "header h1", + "lvl2": "article h2", + "lvl3": "article h3", + "lvl4": "article h4", + "lvl5": "article h5, article td:first-child", + "lvl6": "article h6", + "text": "article p, article li, article td:last-child" + }, + "strip_chars": " .,;:#", + "custom_settings": { + "separatorsToIndex": "_", + "attributesForFaceting": [ + "language", + "version", + "type", + "docusaurus_tag" + ], + "attributesToRetrieve": [ + "hierarchy", + "content", + "anchor", + "url", + "url_without_anchor", + "type" + ] + } +} From 87cd4ad59a38f0d6a2075e91d0e4df08ea867c99 Mon Sep 17 00:00:00 2001 From: mikeD42 <62258801+mikeD42@users.noreply.github.com> Date: Thu, 27 Jul 2023 17:20:10 -0400 Subject: [PATCH 4/4] DO-4165 invalidation syntax error Fixing path syntax for invalidation call --- .github/workflows/build-and-deploy.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/build-and-deploy.yml b/.github/workflows/build-and-deploy.yml index ff68eaca..71c23378 100644 --- a/.github/workflows/build-and-deploy.yml +++ b/.github/workflows/build-and-deploy.yml @@ -37,7 +37,7 @@ jobs: - name: Invalidate CF cache run: | - INVAL_ID=$(aws cloudfront create-invalidation --distribution-id ${{ env.CF_DISTRO }} --paths "*" | jq -r .Invalidation.Id ) + INVAL_ID=$(aws cloudfront create-invalidation --distribution-id ${{ env.CF_DISTRO }} --paths "/*" | jq -r .Invalidation.Id ) aws cloudfront wait invalidation-completed --distribution-id ${{ env.CF_DISTRO }} --id $INVAL_ID - name: Setup Algolia Config