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/.github/workflows/preview.yaml b/.github/workflows/preview.yaml new file mode 100644 index 000000000..a84e33405 --- /dev/null +++ b/.github/workflows/preview.yaml @@ -0,0 +1,40 @@ +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: 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 }} + 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 + + - name: Deploy preview + uses: rossjrw/pr-preview-action@v1 + with: + source-dir: ./build/ \ No newline at end of file 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 }} diff --git a/docusaurus.config.ts b/docusaurus.config.ts index cbf08bd79..05c9397fe 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: '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: '/', + 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,