From 5001ac8efab50d9d95236e4b60c9343e54011ec0 Mon Sep 17 00:00:00 2001 From: Chaminda Divitotawela Date: Fri, 2 Aug 2024 08:57:07 +1000 Subject: [PATCH] Check released version and configured version (#196) * Check released version and configured version Recently same version published and caused issues for the downstream applications with checksum changes. Added GitHub step check whether the version configured has been released previously. This will prevent overriding existing releases Signed-off-by: Chaminda Divitotawela * Update .github/workflows/build.yml Co-authored-by: Sally MacFarlane Signed-off-by: Chaminda Divitotawela * Update .github/workflows/build.yml Co-authored-by: Sally MacFarlane Signed-off-by: Chaminda Divitotawela --------- Signed-off-by: Chaminda Divitotawela Signed-off-by: Chaminda Divitotawela Co-authored-by: Sally MacFarlane --- .github/workflows/build.yml | 19 +++++++++++++++++++ 1 file changed, 19 insertions(+) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6294e842..ebc5ca3e 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -32,6 +32,25 @@ jobs: uses: actions/checkout@v4 with: submodules: recursive + # Check whether gradle.properties version has been released already + # This prevents accidently publish same version + # Only check binary for arithmetic as all published together and arithmetic is the first + - name: Check existing release + run: | + # Check whether version contains SNAPSHOT + grep "^version" gradle.properties | grep -q SNAPSHOT || { + # Extract version from gradle.properties + VERSION=$(grep "^version" gradle.properties | sed 's|^version=\(.*\)$|\1|g') + echo "Query for version [$VERSION]" + curl --head -L --silent --output /dev/null --fail "$ART_URL/$VERSION" && { + echo "ERROR: Binary arithmetic already exists for version [$VERSION]" + echo "ERROR: Blocking republishing same version to the Besu Artifactory" + echo "url $ART_URL/$VERSION" + exit 1 + } + } + env: + ART_URL: 'https://hyperledger.jfrog.io/artifactory/besu-maven/org/hyperledger/besu/arithmetic' - name: Build run: ./build.sh - uses: actions/upload-artifact@v3.1.0