forked from public-awesome/cw-nfts
-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
100 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,46 @@ | ||
#!/bin/bash | ||
set -o errexit -o nounset -o pipefail | ||
command -v shellcheck > /dev/null && shellcheck "$0" | ||
|
||
# these are imported by other packages | ||
ALL_PACKAGES="cw721" | ||
|
||
# these are imported by other contracts | ||
BASE_CONTRACTS="cw721-base" | ||
ALL_CONTRACTS="cw721-metadata-onchain" | ||
|
||
SLEEP_TIME=30 | ||
|
||
for pack in $ALL_PACKAGES; do | ||
( | ||
cd "packages/$pack" | ||
echo "Publishing $pack" | ||
cargo publish | ||
) | ||
done | ||
|
||
# wait for these to be processed on crates.io | ||
echo "Waiting for publishing all packages" | ||
sleep $SLEEP_TIME | ||
|
||
for cont in $BASE_CONTRACTS; do | ||
( | ||
cd "contracts/$cont" | ||
echo "Publishing $cont" | ||
cargo publish | ||
) | ||
done | ||
|
||
# wait for these to be processed on crates.io | ||
echo "Waiting for publishing base packages" | ||
sleep $SLEEP_TIME | ||
|
||
for cont in $ALL_CONTRACTS; do | ||
( | ||
cd "contracts/$cont" | ||
echo "Publishing $cont" | ||
cargo publish | ||
) | ||
done | ||
|
||
echo "Everything is published!" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
#!/bin/bash | ||
set -o errexit -o nounset -o pipefail | ||
command -v shellcheck > /dev/null && shellcheck "$0" | ||
|
||
function print_usage() { | ||
echo "Usage: $0 NEW_VERSION" | ||
echo "" | ||
echo "e.g. $0 0.8.0" | ||
} | ||
|
||
if [ "$#" -ne 1 ]; then | ||
print_usage | ||
exit 1 | ||
fi | ||
|
||
# Check repo | ||
SCRIPT_DIR="$(realpath "$(dirname "$0")")" | ||
if [[ "$(realpath "$SCRIPT_DIR/..")" != "$(pwd)" ]]; then | ||
echo "Script must be called from the repo root" | ||
exit 2 | ||
fi | ||
|
||
# Ensure repo is not dirty | ||
CHANGES_IN_REPO=$(git status --porcelain) | ||
if [[ -n "$CHANGES_IN_REPO" ]]; then | ||
echo "Repository is dirty. Showing 'git status' and 'git --no-pager diff' for debugging now:" | ||
git status && git --no-pager diff | ||
exit 3 | ||
fi | ||
|
||
NEW="$1" | ||
OLD=$(sed -n -e 's/^version[[:space:]]*=[[:space:]]*"\(.*\)"/\1/p' packages/cw721/Cargo.toml) | ||
echo "Updating old version $OLD to new version $NEW ..." | ||
|
||
FILES_MODIFIED=() | ||
|
||
for package_dir in packages/*/; do | ||
CARGO_TOML="$package_dir/Cargo.toml" | ||
sed -i -e "s/version[[:space:]]*=[[:space:]]*\"$OLD\"/version = \"$NEW\"/" "$CARGO_TOML" | ||
FILES_MODIFIED+=("$CARGO_TOML") | ||
done | ||
|
||
for contract_dir in contracts/*/; do | ||
CARGO_TOML="$contract_dir/Cargo.toml" | ||
sed -i -e "s/version[[:space:]]*=[[:space:]]*\"$OLD\"/version = \"$NEW\"/" "$CARGO_TOML" | ||
FILES_MODIFIED+=("$CARGO_TOML") | ||
done | ||
|
||
cargo build | ||
FILES_MODIFIED+=("Cargo.lock") | ||
|
||
echo "Staging ${FILES_MODIFIED[*]} ..." | ||
git add "${FILES_MODIFIED[@]}" | ||
git commit -m "Set version: $NEW" |