From 0ed17a86e0a4f34f9dfc4796f65da3069c190e74 Mon Sep 17 00:00:00 2001 From: alandefreitas Date: Mon, 24 Apr 2023 20:59:19 -0300 Subject: [PATCH] build scripts validate antora executable --- .github/workflows/publish.yml | 2 +- libdoc.sh | 19 ++++++++++--------- sitedoc.sh | 19 ++++++++++--------- 3 files changed, 21 insertions(+), 19 deletions(-) diff --git a/.github/workflows/publish.yml b/.github/workflows/publish.yml index 51d4a4f..b9e6c29 100644 --- a/.github/workflows/publish.yml +++ b/.github/workflows/publish.yml @@ -60,7 +60,7 @@ jobs: SOURCE_DIR: ${{ format('build/{0}', steps.docs-dir.outputs.boost_docs_basename) }} DEST_DIR: ${{ format('site-docs/{0}', (github.ref_name == 'develop' && 'develop') || (github.ref_name == 'master' && 'master') || github.ref_name_name) }} - - name: AWS Sync (staging on GKE) + - name: AWS Sync (production on GKE) if: (github.ref == 'refs/heads/master' || github.ref == 'refs/heads/develop') && github.event_name == 'push' && github.repository == 'cppalliance/site-docs' uses: jakejarvis/s3-sync-action@master with: diff --git a/libdoc.sh b/libdoc.sh index 3ff3a49..a09b274 100755 --- a/libdoc.sh +++ b/libdoc.sh @@ -27,22 +27,23 @@ if [ -z "$node_version" ]; then echo "Node.js is not installed" exit 1 fi -#major_version=$(echo $node_version | egrep -o "v([0-9]+)\." | cut -c 2- | rev | cut -c 2- | rev) -#if [ "$major_version" -lt "16" ]; then -# echo "Node.js version $node_version is not supported. Please upgrade to version 16 or higher." -# node_path=$(which node) -# echo "node_path=${node_path}" -# exit 1 -#fi +major_version=$(echo $node_version | egrep -o "v([0-9]+)\." | cut -c 2- | rev | cut -c 2- | rev) +if [ "$major_version" -lt "16" ]; then + echo "Node.js version $node_version is not supported. Please upgrade to version 16 or higher." + node_path=$(which node) + echo "node_path=${node_path}" +fi -if [ -x antora ]; then +antora_version=$(antora --version 2>/dev/null) +if [ -n "$antora_version" ]; then ANTORA_CMD='antora' else npx_version=$(npx --version 2>/dev/null) - ANTORA_CMD='npx antora' if [ -z "$npx_version" ]; then echo "Neither antora nor npx are installed" exit 1 + else + ANTORA_CMD='npx antora' fi fi diff --git a/sitedoc.sh b/sitedoc.sh index 4c99d69..8c5eb69 100755 --- a/sitedoc.sh +++ b/sitedoc.sh @@ -20,22 +20,23 @@ if [ -z "$node_version" ]; then echo "Node.js is not installed"play exit 1 fi -#major_version=$(echo $node_version | egrep -o "v([0-9]+)\." | cut -c 2- | rev | cut -c 2- | rev) -#if [ "$major_version" -lt "16" ]; then -# echo "Node.js version $node_version is not supported. Please upgrade to version 16 or higher." -# node_path=$(which node) -# echo "node_path=${node_path}" -# exit 1 -#fi +major_version=$(echo $node_version | egrep -o "v([0-9]+)\." | cut -c 2- | rev | cut -c 2- | rev) +if [ "$major_version" -lt "16" ]; then + echo "Node.js version $node_version is not supported. Please upgrade to version 16 or higher." + node_path=$(which node) + echo "node_path=${node_path}" +fi -if [ -x antora ]; then +antora_version=$(antora --version 2>/dev/null) +if [ -n "$antora_version" ]; then ANTORA_CMD='antora' else npx_version=$(npx --version 2>/dev/null) - ANTORA_CMD='npx antora' if [ -z "$npx_version" ]; then echo "Neither antora nor npx are installed" exit 1 + else + ANTORA_CMD='npx antora' fi fi