From b13c551beb004b609e6116bd954389521f683845 Mon Sep 17 00:00:00 2001 From: "Addisu Z. Taddese" Date: Thu, 25 Apr 2024 12:59:09 -0500 Subject: [PATCH] Upload to ign-gazebo docs to both api/gazebo and api/sim (#436) The upload_doc.sh script uploads to s3://gazebosim.org/api/gazebo/ when building gz-sim versions lower than 6 (Fortress). However, our website has links to https://gazebosim.org/api/sim/6/, which are currently outdated (there must have been a manual upload at some point). This fixes the problem by syncing the api/gazebo/${majorVersion} files into the api/sim/${majorVersion} directory. --------- Signed-off-by: Addisu Z. Taddese --- tools/scripts/build_gz.sh | 13 +++++++++++++ 1 file changed, 13 insertions(+) diff --git a/tools/scripts/build_gz.sh b/tools/scripts/build_gz.sh index cbd8c6517..1889ae88f 100755 --- a/tools/scripts/build_gz.sh +++ b/tools/scripts/build_gz.sh @@ -42,6 +42,19 @@ if [[ ! -z "$4" && "$4" != "n" ]]; then libName=`echo "$2" | grep -oP "(?<=gz-).*"` libName="${libName//-/_}" + majorVersion="${version/\.*/}" + # Make sure the majorVersion is a valid number + numberCheckRegex='^[0-9]+$' + if [[ $majorVersion =~ $numberCheckRegex ]]; then + # If this is ign-gazebo (gz-sim <= 6), the upload_doc.sh will upload to api/gazebo so we'll need to + # sync to api/sim manually + if [[ "$libName" == "sim" && "$majorVersion" -le 6 ]]; then + aws s3 sync s3://gazebosim.org/api/gazebo/${majorVersion}/ s3://gazebosim.org/api/sim/${majorVersion}/ + fi + else + echo "Invalid major version ${majorVersion}" + fi + echo -e "\e[46m\e[30mAdding version [$version] for library [$libName], release date [$5]...\e[0m\e[39m" curl -k -X POST -d '{"libName":"'"$libName"'", "version":"'"$version"'", "releaseDate":"'"$5"'","password":"'"$6"'"}' https://api.gazebosim.org/1.0/versions echo -e "\e[46m\e[30mAdded version [$version] for library [$libName], release date [$5]\e[0m\e[39m"