Skip to content

Commit

Permalink
ci: fix script to fetch artifacts versions
Browse files Browse the repository at this point in the history
  • Loading branch information
mantricjavier committed Nov 13, 2024
1 parent 3ac0d84 commit 825385e
Show file tree
Hide file tree
Showing 3 changed files with 16 additions and 7 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/release-artifacts-on-tag.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:
$GITHUB_WORKSPACE/scripts/build_release.sh
tar -zcvf cosmwasm-artifacts.tar.gz artifacts
- name: Get Artifacts Versions
run: $GITHUB_WORKSPACE/scripts/get_artifacts_versions.sh > artifact_versions.txt
run: $GITHUB_WORKSPACE/scripts/get_artifacts_versions.sh --skip-verbose > artifact_versions.txt
- name: Create Release
uses: softprops/action-gh-release@v1
with:
Expand Down
2 changes: 1 addition & 1 deletion justfile
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ optimize:

# Prints the artifacts versions on the current commit.
get-artifacts-versions:
scripts/get_artifacts_versions.sh
scripts/get_artifacts_versions.sh --skip-verbose

# Prints the artifacts size. Optimize should be called before.
get-artifacts-size:
Expand Down
19 changes: 14 additions & 5 deletions scripts/get_artifacts_versions.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,16 +3,25 @@ set -e

project_root_path=$(realpath "$0" | sed 's|\(.*\)/.*|\1|' | cd ../ | pwd)

echo -e "\nGetting artifacts versions...\n"
echo -e "Contracts::\n"
if [ "$1" != "--skip-verbose" ]; then
echo -e "\nGetting artifacts versions...\n"
fi

echo -e "\033[1mContracts:\033[0m"
for artifact in artifacts/*.wasm; do
artifact="${artifact%-*}"
artifact=$(echo $artifact | sed 's/_/-/g')
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 "%-25s %s\n" "$(basename $artifact)" ": $version"
printf "%-20s %s\n" "$(basename $artifact)" ": $version"
done
echo -e "\nPackages::\n"
echo -e "\n\033[1mPackages:\033[0m"

for package in packages/*; do
version=$(cat ''"$package"'/Cargo.toml' | awk -F= '/^version/ { print $2 }')
version="${version//\"/}"

echo -e "\n"
printf "%-20s %s\n" "$(basename $package)" ": $version"
done

0 comments on commit 825385e

Please sign in to comment.