From 40887d4bc1ed9768a33b89b20bb9516d44fc7eb7 Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Fri, 28 Mar 2025 08:27:56 +0100 Subject: [PATCH 1/4] chore: really verify microsite Signed-off-by: benjdlambert --- .github/workflows/verify_microsite.yml | 226 ++++++++++++++++++++++++- 1 file changed, 217 insertions(+), 9 deletions(-) diff --git a/.github/workflows/verify_microsite.yml b/.github/workflows/verify_microsite.yml index c46ba57e97..7b6416c878 100644 --- a/.github/workflows/verify_microsite.yml +++ b/.github/workflows/verify_microsite.yml @@ -13,6 +13,166 @@ permissions: contents: read jobs: + stable: + runs-on: ubuntu-latest + concurrency: + group: stable-reference-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + + env: + CI: true + NODE_OPTIONS: --max-old-space-size=8192 + + outputs: + release: ${{ steps.find-release.outputs.result }} + + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + + - name: find latest release + uses: actions/github-script@60a0d83039c74a4aee543508d2ffcb1c3799cdea # v7 + id: find-release + with: + script: | + const { data } = await github.rest.repos.listTags({ + owner: context.repo.owner, + repo: context.repo.repo, + per_page: 100, + }) + + const [{tag}] = data + .map(i => i.name) + .filter(tag => tag.match(/^v\d+\.\d+\.\d+$/)) + .map(tag => ({ + tag, + val: tag + .slice(1) + .split('.') + .reduce((val, part) => Number(val) * 1000 + Number(part)) + })) + .sort((a, b) => b.val - a.val) + + return tag + result-encoding: string + + - name: checkout latest release + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + ref: refs/tags/${{ steps.find-release.outputs.result }} + + - name: Use Node.js 20.x + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 + with: + node-version: 20.x + registry-url: https://registry.npmjs.org/ # Needed for auth + + - name: yarn install + uses: backstage/actions/yarn-install@b3c1841fd69e1658ac631afafd0fb140a2309024 # v0.6.17 + with: + cache-prefix: ${{ runner.os }}-v20.x + + - name: build API reference + run: yarn build:api-docs + + - name: upload API reference + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: stable-reference + path: docs/reference/ + if-no-files-found: error + retention-days: 1 + + - name: microsite yarn install + run: yarn install --immutable + working-directory: microsite + + - name: build OpenAPI API docs + working-directory: microsite + run: yarn docusaurus gen-api-docs all + + - name: upload OpenAPI API docs + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: stable-openapi-docs + path: docs/**/api/**/* + if-no-files-found: error + retention-days: 1 + next: + runs-on: ubuntu-latest + concurrency: + group: next-reference-${{ github.workflow }}-${{ github.ref }} + cancel-in-progress: true + env: + CI: true + NODE_OPTIONS: --max-old-space-size=8192 + + steps: + - name: Harden Runner + uses: step-security/harden-runner@cb605e52c26070c328afc4562f0b4ada7618a84e # v2.10.4 + with: + egress-policy: audit + + - name: checkout master + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + + - name: Use Node.js 20.x + uses: actions/setup-node@1d0ff469b7ec7b3cb9d8673fde0c81c44821de2a # v4.2.0 + with: + node-version: 20.x + registry-url: https://registry.npmjs.org/ # Needed for auth + + - name: yarn install + uses: backstage/actions/yarn-install@b3c1841fd69e1658ac631afafd0fb140a2309024 # v0.6.17 + with: + cache-prefix: ${{ runner.os }}-v20.x + + - name: build API reference + run: yarn build:api-docs + + - name: upload API reference + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: next-reference + path: docs/reference/ + if-no-files-found: error + retention-days: 1 + + # Also build and upload storybook + - name: storybook yarn install + run: yarn install --immutable + working-directory: storybook + + - name: storybook build + run: yarn build-storybook + working-directory: storybook + + - name: storybook upload + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: storybook + path: storybook/dist/ + if-no-files-found: error + retention-days: 1 + + - name: microsite yarn install + run: yarn install --immutable + working-directory: microsite + + - name: build OpenAPI API docs + working-directory: microsite + run: yarn docusaurus gen-api-docs all + + - name: upload OpenAPI API docs + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: next-openapi-docs + path: docs/**/api/**/* + if-no-files-found: error + retention-days: 1 + build-microsite: runs-on: ubuntu-latest @@ -21,6 +181,10 @@ jobs: NODE_OPTIONS: --max-old-space-size=8192 DOCUSAURUS_SSR_CONCURRENCY: 5 + needs: + - stable + - next + name: Microsite steps: - name: Harden Runner @@ -50,19 +214,63 @@ jobs: run: yarn install --immutable working-directory: microsite - - name: build API reference - run: yarn build:api-docs - - - name: Build MkDocs for TechDocs - run: mkdocs build --strict - - - name: verify yarn dependency duplicates - run: node scripts/verify-lockfile-duplicates.js - - name: prettier run: yarn prettier:check working-directory: microsite + - name: verify yarn dependency duplicates + run: node scripts/verify-lockfile-duplicates.js + + - name: download stable reference + uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4 + with: + name: stable-reference + path: docs/reference + + - name: download stable OpenAPI API docs + uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4 + with: + name: stable-openapi-docs + path: docs + + - name: grab lastest releases docs + run: | + git fetch origin master --depth 1 + git checkout FETCH_HEAD -- docs/releases + + - name: generate stable docs + run: yarn docusaurus docs:version stable + working-directory: microsite + + - name: clear API reference + run: rm -r docs/reference + + - name: clear OpenAPI reference + run: find . -name '*.api.mdx' -type f -delete + + - name: build API reference + run: yarn build:api-docs + + - name: checkout master + uses: actions/checkout@11bd71901bbe5b1630ceea73d27597364c9af683 # v4.2.2 + with: + clean: false + + - name: Build MkDocs for TechDocs + run: mkdocs build --strict + + - name: download next reference + uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4 + with: + name: next-reference + path: docs/reference + + - name: download next OpenAPI API docs + uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4 + with: + name: next-openapi-docs + path: docs + - name: build microsite run: yarn build working-directory: microsite From 3a73c9a66c9c734c3f8e66fb0dfefa103064dccb Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Fri, 28 Mar 2025 09:07:44 +0100 Subject: [PATCH 2/4] chore: why remove the mdx files they need to be there? Signed-off-by: benjdlambert --- .github/workflows/verify_microsite.yml | 23 ++++++++++++++++++----- 1 file changed, 18 insertions(+), 5 deletions(-) diff --git a/.github/workflows/verify_microsite.yml b/.github/workflows/verify_microsite.yml index 7b6416c878..62233497f6 100644 --- a/.github/workflows/verify_microsite.yml +++ b/.github/workflows/verify_microsite.yml @@ -233,6 +233,14 @@ jobs: name: stable-openapi-docs path: docs + - name: upload working dir + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: docs-status + path: docs/** + if-no-files-found: error + retention-days: 1 + - name: grab lastest releases docs run: | git fetch origin master --depth 1 @@ -245,9 +253,6 @@ jobs: - name: clear API reference run: rm -r docs/reference - - name: clear OpenAPI reference - run: find . -name '*.api.mdx' -type f -delete - - name: build API reference run: yarn build:api-docs @@ -256,8 +261,8 @@ jobs: with: clean: false - - name: Build MkDocs for TechDocs - run: mkdocs build --strict + # - name: Build MkDocs for TechDocs + # run: mkdocs build --strict - name: download next reference uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4 @@ -271,6 +276,14 @@ jobs: name: next-openapi-docs path: docs + - name: upload working dir2 + uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 + with: + name: docs-status-2 + path: docs/** + if-no-files-found: error + retention-days: 1 + - name: build microsite run: yarn build working-directory: microsite From fa15fc9347efd6957717e8f4e5fedb27987260ba Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Fri, 28 Mar 2025 10:09:25 +0100 Subject: [PATCH 3/4] chore: don't clean up all mdx files as we need them, just not the ones in the docs folder Signed-off-by: benjdlambert --- .github/workflows/deploy_microsite.yml | 2 +- .github/workflows/verify_microsite.yml | 23 +++++------------------ 2 files changed, 6 insertions(+), 19 deletions(-) diff --git a/.github/workflows/deploy_microsite.yml b/.github/workflows/deploy_microsite.yml index 1f246abd26..28444cecfc 100644 --- a/.github/workflows/deploy_microsite.yml +++ b/.github/workflows/deploy_microsite.yml @@ -235,7 +235,7 @@ jobs: run: rm -r docs/reference - name: clear OpenAPI reference - run: find . -name '*.api.mdx' -type f -delete + run: find ./docs -name '*.api.mdx' -type f -delete # Next docs - name: checkout master diff --git a/.github/workflows/verify_microsite.yml b/.github/workflows/verify_microsite.yml index 62233497f6..4985338da3 100644 --- a/.github/workflows/verify_microsite.yml +++ b/.github/workflows/verify_microsite.yml @@ -233,14 +233,6 @@ jobs: name: stable-openapi-docs path: docs - - name: upload working dir - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 - with: - name: docs-status - path: docs/** - if-no-files-found: error - retention-days: 1 - - name: grab lastest releases docs run: | git fetch origin master --depth 1 @@ -253,6 +245,9 @@ jobs: - name: clear API reference run: rm -r docs/reference + - name: clear OpenAPI reference + run: find ./docs -name '*.api.mdx' -type f -delete + - name: build API reference run: yarn build:api-docs @@ -261,8 +256,8 @@ jobs: with: clean: false - # - name: Build MkDocs for TechDocs - # run: mkdocs build --strict + - name: Build MkDocs for TechDocs + run: mkdocs build --strict - name: download next reference uses: actions/download-artifact@95815c38cf2ff2164869cbab79da8d1f422bc89e # v4 @@ -276,14 +271,6 @@ jobs: name: next-openapi-docs path: docs - - name: upload working dir2 - uses: actions/upload-artifact@ea165f8d65b6e75b540449e92b4886f43607fa02 # v4 - with: - name: docs-status-2 - path: docs/** - if-no-files-found: error - retention-days: 1 - - name: build microsite run: yarn build working-directory: microsite From f838ea2fd7f8062d24704f5e05d64fe60b780f46 Mon Sep 17 00:00:00 2001 From: benjdlambert Date: Fri, 28 Mar 2025 10:18:21 +0100 Subject: [PATCH 4/4] chore: bump old space size Signed-off-by: benjdlambert --- .github/workflows/verify_microsite.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/verify_microsite.yml b/.github/workflows/verify_microsite.yml index 4985338da3..88c1bbc299 100644 --- a/.github/workflows/verify_microsite.yml +++ b/.github/workflows/verify_microsite.yml @@ -178,7 +178,7 @@ jobs: env: CI: true - NODE_OPTIONS: --max-old-space-size=8192 + NODE_OPTIONS: --max-old-space-size=16384 DOCUSAURUS_SSR_CONCURRENCY: 5 needs: