From 914f5b9e9e813200096a4e0c07299a171683b391 Mon Sep 17 00:00:00 2001 From: Servio Zambrano Date: Tue, 2 Jul 2024 15:59:07 -0400 Subject: [PATCH] .Version file was deleted and integrated a self versioning (#430) * self versioning was added * self versioning was added --- .github/workflows/pipeline.yml | 22 +++++++++++++++++++++- .version | 1 - 2 files changed, 21 insertions(+), 2 deletions(-) delete mode 100644 .version diff --git a/.github/workflows/pipeline.yml b/.github/workflows/pipeline.yml index 84f2244f..75cff296 100644 --- a/.github/workflows/pipeline.yml +++ b/.github/workflows/pipeline.yml @@ -53,7 +53,27 @@ jobs: toolchain: stable - name: Compile run: | - VERSION=$(cat .version) + ELYSD=./elysd + json=$($ELYSD q --output json --node "${{vars.NODE}}" wasm contract-state smart "${{vars.FS_CONTRACT_ADDRESS}}" '{ "version": {} }') + echo "Response json: $json" + VERSION=$(echo $json | jq -r ".data.version") + echo "Current version: $VERSION" + + # Extract the major, minor, and patch versions + version_parts=(${VERSION//./ }) + major=${version_parts[0]} + minor=${version_parts[1]} + patch=${version_parts[2]} + + # Increment the minor version + minor=$((minor + 1)) + + # Update the version string + VERSION="$major.$minor.$patch" + + # Print the updated version number + echo "New version number: $VERSION" + sed -i "s/^version = .*/version = \"$VERSION\"/" contracts/account-history-contract/Cargo.toml sed -i "s/^version = .*/version = \"$VERSION\"/" contracts/trade-shield-contract/Cargo.toml sed -i "s/^version = .*/version = \"$VERSION\"/" contracts/financial-snapshot-contract/Cargo.toml diff --git a/.version b/.version deleted file mode 100644 index 85e60ed1..00000000 --- a/.version +++ /dev/null @@ -1 +0,0 @@ -0.34.0