From 32add8980d533d20b6e0829d1ddb9b129f82818e Mon Sep 17 00:00:00 2001 From: Sergey Grigoriev Date: Thu, 27 Jun 2024 14:07:37 +0200 Subject: [PATCH] fix: check if required commands are available maven build will not fail on local machines, but will fail during GitHub Actions build --- .github/workflows/maven-release.yml | 2 ++ .scripts/convert-readme.sh | 9 +++++++-- 2 files changed, 9 insertions(+), 2 deletions(-) diff --git a/.github/workflows/maven-release.yml b/.github/workflows/maven-release.yml index 443ba4f..d418857 100644 --- a/.github/workflows/maven-release.yml +++ b/.github/workflows/maven-release.yml @@ -58,6 +58,8 @@ jobs: run: cat /home/runner/.m2/settings.xml - name: Build with Maven run: mvn --batch-mode -DwpExporterImpl=docker clean package -P tests-with-weasyprint-docker + env: + FAIL_ON_CHECK_COMMANDS: 'true' - name: Extract artefact version id: artefact_version run: echo "version=$(mvn help:evaluate -Dexpression=project.version -q -DforceStdout)" >> $GITHUB_OUTPUT diff --git a/.scripts/convert-readme.sh b/.scripts/convert-readme.sh index 20fbea0..610f20b 100755 --- a/.scripts/convert-readme.sh +++ b/.scripts/convert-readme.sh @@ -7,12 +7,17 @@ function check_command() { if ! command -v "$1" &> /dev/null; then echo -e "\033[0;31m $1 is not installed! \033[0m" >&2 echo -e "\033[0;31m Help for About page will not be generated! \033[0m" >&2 - exit 0 + + if [ -n "$FAIL_ON_CHECK_COMMANDS" ]; then + exit 1 + else + exit 0 + fi fi } # Check if required commands are installed -check_command jq +check_command jq1 check_command curl check_command awk