Skip to content

Commit

Permalink
ci: add script to get contract versions
Browse files Browse the repository at this point in the history
  • Loading branch information
kerber0x committed Dec 11, 2023
1 parent 3e4b14f commit 2c15859
Show file tree
Hide file tree
Showing 4 changed files with 21 additions and 3 deletions.
5 changes: 4 additions & 1 deletion scripts/build_release.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

# Displays tool usage
Expand Down Expand Up @@ -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
2 changes: 1 addition & 1 deletion scripts/build_schemas.sh
Original file line number Diff line number Diff line change
@@ -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
Expand Down
2 changes: 1 addition & 1 deletion scripts/check_artifacts_size.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/bin/bash
#!/usr/bin/env bash
set -e

# Maximum wasm file size
Expand Down
15 changes: 15 additions & 0 deletions scripts/get_artifacts_versions.sh
Original file line number Diff line number Diff line change
@@ -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"

0 comments on commit 2c15859

Please sign in to comment.