From 852468f663ebb8fead959fa5b517eda8e2ce87d0 Mon Sep 17 00:00:00 2001 From: Aman Regu Date: Wed, 13 Nov 2024 16:24:25 +0530 Subject: [PATCH 1/2] docs: update render script --- docs/build-latest-version.sh | 28 +++++++--------------------- 1 file changed, 7 insertions(+), 21 deletions(-) diff --git a/docs/build-latest-version.sh b/docs/build-latest-version.sh index e8004f169d..ece4ff1a5c 100755 --- a/docs/build-latest-version.sh +++ b/docs/build-latest-version.sh @@ -1,31 +1,17 @@ #!/bin/bash set -e -CONFIG_FILE="docusaurus.config.js" +VERSIONS_FILE="versions.json" -# Extract lastVersion from docusaurus.config.js using sed -LAST_VERSION=$(sed -n "s/.*lastVersion: *'\\([^']*\\)'.*/\\1/p" "$CONFIG_FILE") -if [ -z "$LAST_VERSION" ]; then - echo "Error: lastVersion not found in $CONFIG_FILE" +# Ensure versions.json exists +if [ ! -f "$VERSIONS_FILE" ]; then + echo "Error: $VERSIONS_FILE not found." exit 1 fi -echo "Found lastVersion: $LAST_VERSION" -# Extract all version numbers from the entire file -ALL_VERSIONS=$(grep -oE "'[0-9]+\.[0-9]+\.[0-9]+(-[A-Za-z]+)?'" "$CONFIG_FILE" | sed "s/'//g" | sort -u -V -r) -if [ -z "$ALL_VERSIONS" ]; then - echo "Error: No versions found in $CONFIG_FILE" - exit 1 -fi -echo "Found raw versions:" -echo "$ALL_VERSIONS" - -# Convert the extracted versions into a JSON array format -VERSION_ARRAY=$(echo "$ALL_VERSIONS" | jq -R -s -c 'split("\n")[:-1] + ["'"$LAST_VERSION"'"] | unique') -echo "Updating versions.json with: $VERSION_ARRAY" - -# Update versions.json with combined data -echo $VERSION_ARRAY | jq . > versions.json +# Output existing versions from versions.json for reference +echo "Using versions from $VERSIONS_FILE:" +jq . "$VERSIONS_FILE" # Install dependencies and build the project npm i && npm run build From 5b937d71cf8c360d1b875e3feab5a513c19b9ac7 Mon Sep 17 00:00:00 2001 From: Adish M Date: Wed, 13 Nov 2024 16:48:43 +0530 Subject: [PATCH 2/2] Removed build-latest-version.sh from docs-pr-app workflow --- .github/workflows/docs-pr-app.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/docs-pr-app.yml b/.github/workflows/docs-pr-app.yml index ae605c660c..612d857b76 100644 --- a/.github/workflows/docs-pr-app.yml +++ b/.github/workflows/docs-pr-app.yml @@ -53,7 +53,7 @@ jobs: ], "serviceDetails": { "pullRequestPreviewsEnabled": "no", - "buildCommand": "bash build-latest-version.sh", + "buildCommand": "npm i && npm run build", "publishPath": "build/", "url": "https://tooljet-pr-${{ env.PR_NUMBER }}.onrender.com" }