From 2c1585966481b958e7676c0813afa17e3484f0cb Mon Sep 17 00:00:00 2001 From: Kerber0x Date: Mon, 11 Dec 2023 15:48:28 +0000 Subject: [PATCH] ci: add script to get contract versions --- scripts/build_release.sh | 5 ++++- scripts/build_schemas.sh | 2 +- scripts/check_artifacts_size.sh | 2 +- scripts/get_artifacts_versions.sh | 15 +++++++++++++++ 4 files changed, 21 insertions(+), 3 deletions(-) create mode 100755 scripts/get_artifacts_versions.sh diff --git a/scripts/build_release.sh b/scripts/build_release.sh index ecc5dd62..92be1748 100755 --- a/scripts/build_release.sh +++ b/scripts/build_release.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Displays tool usage @@ -78,3 +78,6 @@ echo "${docker_command[@]}" # Check generated wasm file sizes $projectRootPath/scripts/check_artifacts_size.sh + +# Check generated wasm file sizes +$projectRootPath/scripts/get_artifacts_versions.sh diff --git a/scripts/build_schemas.sh b/scripts/build_schemas.sh index 39dfa0b4..a2075e72 100755 --- a/scripts/build_schemas.sh +++ b/scripts/build_schemas.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # First argument, whether or not to run git diff and exit with an error on any json file diff, not used by default if [[ -z $1 ]]; then diff --git a/scripts/check_artifacts_size.sh b/scripts/check_artifacts_size.sh index 385f65f8..3d6d4018 100755 --- a/scripts/check_artifacts_size.sh +++ b/scripts/check_artifacts_size.sh @@ -1,4 +1,4 @@ -#!/bin/bash +#!/usr/bin/env bash set -e # Maximum wasm file size diff --git a/scripts/get_artifacts_versions.sh b/scripts/get_artifacts_versions.sh new file mode 100755 index 00000000..614729f7 --- /dev/null +++ b/scripts/get_artifacts_versions.sh @@ -0,0 +1,15 @@ +#!/usr/bin/env bash +set -e + +project_root_path=$(realpath "$0" | sed 's|\(.*\)/.*|\1|' | cd ../ | pwd) + +echo -e "\nGetting artifacts versions...\n" +for artifact in artifacts/*.wasm; do + artifact="${artifact%-*}" + contract_path=$(find "$project_root_path" -iname $(cut -d . -f 1 <<<$(basename $artifact)) -type d) + version=$(cat ''"$contract_path"'/Cargo.toml' | awk -F= '/^version/ { print $2 }') + version="${version//\"/}" + + printf "%-20s %s\n" "$(basename $artifact)" ":$version" +done +echo -e "\n"