From 687ec6054a7d6d5f34fdd5533adfd68eee410f33 Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Mon, 16 Sep 2024 21:18:14 +0000 Subject: [PATCH 01/11] add env vars for docusaurus site config #97 --- .devcontainer/.env | 14 ++++++++++++-- docusaurus.config.ts | 12 ++++++------ 2 files changed, 18 insertions(+), 8 deletions(-) diff --git a/.devcontainer/.env b/.devcontainer/.env index d91d263d5..6116cde8a 100644 --- a/.devcontainer/.env +++ b/.devcontainer/.env @@ -1,2 +1,12 @@ -UMAMI_WEBSITE_ID="00000000-0000-0000-0000-000000000000" -UMAMI_ANALYTICS_DOMAIN="localhost" +# DOCS_NEXT +export REACT_APP_VERSION="0.1-development" +export REACT_APP_DOCS_NEXT_HOST="docs-next.example.de" +export REACT_APP_DOCS_NEXT_ORG="akyriako" + +# DOCUSAURUS +export REACT_APP_DOCUSAURUS_BASE_URL="/" + +# UMAMI +export UMAMI_WEBSITE_ID="00000000-0000-0000-0000-000000000000" +export UMAMI_ANALYTICS_DOMAIN="localhost" + diff --git a/docusaurus.config.ts b/docusaurus.config.ts index cbf08bd79..c1f217a8a 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -4,21 +4,21 @@ import type * as Preset from '@docusaurus/preset-classic'; import type { Options as UmamiOptions } from '@dipakparmar/docusaurus-plugin-umami'; const config: Config = { - title: 'Architecture Center - GO/S/A/TLS', + title: 'Architecture Center', tagline: 'Best Practices & Blueprints', favicon: 'img/favicon.ico', // Set the production url of your site here - url: 'http://docs-next.hypelens.de', + url: 'http://' + process.env.REACT_APP_DOCS_NEXT_HOST, // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' - baseUrl: '/', + baseUrl: process.env.REACT_APP_DOCUSAURUS_BASE_URL, // GitHub pages deployment config. // If you aren't using GitHub pages, you don't need these. - organizationName: 'akyriako', // Usually your GitHub org/user name. + organizationName: process.env.REACT_APP_DOCS_NEXT_ORG, // Usually your GitHub org/user name. projectName: 'docs-next', // Usually your repo name. - deploymentBranch: 'gh-pages', + trailingSlash: false, onBrokenLinks: 'throw', onBrokenMarkdownLinks: 'warn', @@ -211,7 +211,7 @@ const config: Config = { ], }, ], - copyright: `© T-Systems International GmbH ${new Date().getFullYear()}`, + copyright: `© T-Systems International GmbH ${new Date().getFullYear()} (` + process.env.REACT_APP_VERSION + `)`, }, prism: { theme: prismThemes.oneDark, From c07e0d6cbd08091424c864d3ef4eaf587c761b0e Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Mon, 16 Sep 2024 21:23:59 +0000 Subject: [PATCH 02/11] add envs in release workflow #97 --- .github/workflows/release.yaml | 10 ++++++++++ 1 file changed, 10 insertions(+) diff --git a/.github/workflows/release.yaml b/.github/workflows/release.yaml index 06e8b9e80..35dc0e482 100644 --- a/.github/workflows/release.yaml +++ b/.github/workflows/release.yaml @@ -1,3 +1,5 @@ +name: build-and-release + on: push: branches: @@ -26,6 +28,10 @@ jobs: - name: Build App env: + REACT_APP_VERSION: ${{ vars.APP_VERSION }}.${{github.run_number}}-${{ steps.commit_hash.outputs.short }}-preview + REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }} + REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }} + REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }} REACT_APP_TYPESENSE_PROTOCOL: ${{ vars.TYPESENSE_PROTOCOL }} REACT_APP_TYPESENSE_HOST: ${{ vars.TYPESENSE_HOST }} REACT_APP_TYPESENSE_PORT: ${{ vars.TYPESENSE_PORT }} @@ -81,6 +87,10 @@ jobs: - name: Build App env: + REACT_APP_VERSION: ${{ vars.APP_VERSION }}.${{github.run_number}}-${{ steps.commit_hash.outputs.short }}-stable + REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }} + REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }} + REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }} REACT_APP_TYPESENSE_PROTOCOL: ${{ vars.TYPESENSE_PROTOCOL }} REACT_APP_TYPESENSE_HOST: ${{ vars.TYPESENSE_HOST }} REACT_APP_TYPESENSE_PORT: ${{ vars.TYPESENSE_PORT }} From a7e51eaab8818e57791228d69d0d76357ee24084 Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Mon, 16 Sep 2024 21:26:35 +0000 Subject: [PATCH 03/11] added preview workflow #97 --- .github/workflows/preview.yaml | 36 ++++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 .github/workflows/preview.yaml diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml new file mode 100644 index 000000000..2ffbb7bf9 --- /dev/null +++ b/.github/workflows/preview.yaml @@ -0,0 +1,36 @@ +name: pull-requests-preview-deployment + +on: + pull_request: + types: + - opened + - reopened + - synchronize + - closed + +concurrency: preview-${{ github.ref }} + +jobs: + deploy-preview: + environment: pull-requests-preview + runs-on: ubuntu-20.04 + + steps: + - name: Checkout + uses: actions/checkout@v3 + + - name: Install and Build + if: github.event.action != 'closed' + env: + REACT_APP_VERSION: ${{ vars.APP_VERSION }}.${{github.run_number}}-${{ steps.commit_hash.outputs.short }}-preview + REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }} + REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }} + REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }}pr-${{ github.event.pull_request.number }} + run: | + npm install + npm run build + + - name: Deploy preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: ./build/ \ No newline at end of file From 6bffd22ac4b0621bc6918a8fd2ce79e5917ea7c7 Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Mon, 16 Sep 2024 21:39:31 +0000 Subject: [PATCH 04/11] added missing env vars in preview workflow #97 --- .github/workflows/preview.yaml | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 2ffbb7bf9..eb393aa34 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -22,10 +22,14 @@ jobs: - name: Install and Build if: github.event.action != 'closed' env: - REACT_APP_VERSION: ${{ vars.APP_VERSION }}.${{github.run_number}}-${{ steps.commit_hash.outputs.short }}-preview + REACT_APP_VERSION: ${{ vars.APP_VERSION }}.${{github.run_number}}-$pr-${{ github.event.pull_request.number }}-preview REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }} REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }} REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }}pr-${{ github.event.pull_request.number }} + UMAMI_WEBSITE_ID: ${{ vars.UMAMI_WEBSITE_ID }} + UMAMI_ANALYTICS_DOMAIN: ${{ vars.UMAMI_ANALYTICS_DOMAIN }} + UMAMI_DATAHOST_URL: ${{ vars.UMAMI_DATAHOST_URL }} + UMAMI_DATA_DOMAIN: ${{ vars.UMAMI_DATA_DOMAINS }} run: | npm install npm run build From c4a7bbbe578ef5bacee4b39fefa456ebbb04b6ec Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Mon, 16 Sep 2024 21:42:46 +0000 Subject: [PATCH 05/11] fixed REACT_APP_VERSION in preview workflow #97 --- .github/workflows/preview.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index eb393aa34..2c021d16c 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -22,7 +22,7 @@ jobs: - name: Install and Build if: github.event.action != 'closed' env: - REACT_APP_VERSION: ${{ vars.APP_VERSION }}.${{github.run_number}}-$pr-${{ github.event.pull_request.number }}-preview + REACT_APP_VERSION: ${{ vars.APP_VERSION }}.${{github.run_number}}-pr-${{ github.event.pull_request.number }}-preview REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }} REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }} REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }}pr-${{ github.event.pull_request.number }} From 95bd1076e53e925c52ec4592b2df0e8321a7248a Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Mon, 16 Sep 2024 21:48:27 +0000 Subject: [PATCH 06/11] changed REACT_APP_VERSION in preview workflow #97 --- .github/workflows/preview.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 2c021d16c..68fe80e66 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -22,7 +22,7 @@ jobs: - name: Install and Build if: github.event.action != 'closed' env: - REACT_APP_VERSION: ${{ vars.APP_VERSION }}.${{github.run_number}}-pr-${{ github.event.pull_request.number }}-preview + REACT_APP_VERSION: ${{ vars.APP_VERSION }}.x-pr-${{ github.event.pull_request.number }}-preview REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }} REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }} REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }}pr-${{ github.event.pull_request.number }} From f6f3b7f6a068645431b56534d940ad349835dab2 Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Mon, 16 Sep 2024 21:53:15 +0000 Subject: [PATCH 07/11] added run id in REACT_APP_VERSION in preview workflow #97 --- .github/workflows/preview.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 68fe80e66..f06b7186d 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -22,7 +22,7 @@ jobs: - name: Install and Build if: github.event.action != 'closed' env: - REACT_APP_VERSION: ${{ vars.APP_VERSION }}.x-pr-${{ github.event.pull_request.number }}-preview + REACT_APP_VERSION: ${{ vars.APP_VERSION }}/run:${{github.run_number}}/pr:${{ github.event.pull_request.number }}/preview REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }} REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }} REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }}pr-${{ github.event.pull_request.number }} From 2da5e22af32feeba225f2178bfbfac81725f74c7 Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Mon, 16 Sep 2024 21:58:14 +0000 Subject: [PATCH 08/11] changed REACT_APP_VERSION #97 --- .github/workflows/preview.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index f06b7186d..1f8ce4f41 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -22,7 +22,7 @@ jobs: - name: Install and Build if: github.event.action != 'closed' env: - REACT_APP_VERSION: ${{ vars.APP_VERSION }}/run:${{github.run_number}}/pr:${{ github.event.pull_request.number }}/preview + REACT_APP_VERSION: preview/${{ github.event.pull_request.name }}#${{github.run_number}} REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }} REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }} REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }}pr-${{ github.event.pull_request.number }} From e23b6f5413768932935e39bd8435607b297a5d44 Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Mon, 16 Sep 2024 22:01:15 +0000 Subject: [PATCH 09/11] brought back pr id in REACT_APP_VERSION #97 --- .github/workflows/preview.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 1f8ce4f41..75d7b466e 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -22,7 +22,7 @@ jobs: - name: Install and Build if: github.event.action != 'closed' env: - REACT_APP_VERSION: preview/${{ github.event.pull_request.name }}#${{github.run_number}} + REACT_APP_VERSION: env:preview/pr:${{ github.event.pull_request.id }}#${{ github.run_number }} REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }} REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }} REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }}pr-${{ github.event.pull_request.number }} From 35e4e758f9dc56a1f62f1d87456e05be7966e638 Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Mon, 16 Sep 2024 22:02:30 +0000 Subject: [PATCH 10/11] fixed REACT_APP_VERSION #97 --- .github/workflows/preview.yaml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/preview.yaml b/.github/workflows/preview.yaml index 75d7b466e..a84e33405 100644 --- a/.github/workflows/preview.yaml +++ b/.github/workflows/preview.yaml @@ -22,7 +22,7 @@ jobs: - name: Install and Build if: github.event.action != 'closed' env: - REACT_APP_VERSION: env:preview/pr:${{ github.event.pull_request.id }}#${{ github.run_number }} + REACT_APP_VERSION: env:preview/pr:${{ github.event.pull_request.number }}-${{ github.run_number }} REACT_APP_DOCS_NEXT_HOST: ${{ vars.DOCS_NEXT_HOST }} REACT_APP_DOCS_NEXT_ORG: ${{ vars.DOCS_NEXT_ORG }} REACT_APP_DOCUSAURUS_BASE_URL: ${{ vars.DOCUSAURUS_BASE_URL }}pr-${{ github.event.pull_request.number }} From a19200021c0d1b9192c4a712e2cd082ac09beac6 Mon Sep 17 00:00:00 2001 From: Kyriakos Akriotis Date: Mon, 16 Sep 2024 22:08:48 +0000 Subject: [PATCH 11/11] changed config.url to https #97 --- docusaurus.config.ts | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/docusaurus.config.ts b/docusaurus.config.ts index c1f217a8a..05c9397fe 100644 --- a/docusaurus.config.ts +++ b/docusaurus.config.ts @@ -9,7 +9,7 @@ const config: Config = { favicon: 'img/favicon.ico', // Set the production url of your site here - url: 'http://' + process.env.REACT_APP_DOCS_NEXT_HOST, + url: 'https://' + process.env.REACT_APP_DOCS_NEXT_HOST, // Set the // pathname under which your site is served // For GitHub pages deployment, it is often '//' baseUrl: process.env.REACT_APP_DOCUSAURUS_BASE_URL,