From f105c86fabb1672099c3d420c2ed62e76b530e1f Mon Sep 17 00:00:00 2001 From: Chaminda Divitotawela Date: Wed, 21 Aug 2024 08:14:42 +1000 Subject: [PATCH] PR review changes Using if condition to make the code more readable and only check for release version with a regex Signed-off-by: Chaminda Divitotawela --- .github/workflows/build.yml | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d03e3ff6..cc45a5b8 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -41,13 +41,14 @@ jobs: # Only check binary for arithmetic as all published together and arithmetic is the first - name: Check release published run: | - # Skip if version contain SNAPSHOT - grep "^version" gradle.properties | grep -q SNAPSHOT || { + # Only interested in release version + if [[ $(grep -E 'version=[0-9]+\.[0-9]+\.[0-9]+$' gradle.properties | wc -l) -ne 0 ]] + then # Extract version from gradle.properties VERSION=$(grep "^version" gradle.properties | sed 's|^version=\(.*\)$|\1|g') echo "Query for version [$VERSION]" RESPONSE_CODE=$(curl --head -L --silent --output /dev/null --write-out %{http_code} "$ART_URL/$VERSION") - echo "DEBUG: Response code from curl command [$RESPONSE_CODE]" + echo "Response code for curl command [$RESPONSE_CODE]" if [[ $RESPONSE_CODE == "404" ]] then echo "Version [$VERSION] has not yet been published" @@ -63,8 +64,11 @@ jobs: echo "WARN: Failing job due to unknown status" exit 1 fi + fi - } + else + echo "No validation as not a release version" + fi env: ART_URL: 'https://hyperledger.jfrog.io/artifactory/besu-maven/org/hyperledger/besu/arithmetic' - name: Build