#!/bin/bash set -eou pipefail export PATH=$PATH:/root/.cargo/bin/ rustup default stable NEW_VERSION=$1 if ! [[ ${NEW_VERSION} =~ ^[0-9]+[.][0-9]+[.][0-9]+$ ]] then echo "Incorrect version format: " $NEW_VERSION exit 1 fi # configure rust lib to release sed -i 's/version = "*.*.*" # This version will be automatically updated/version = "'${NEW_VERSION}'"/' Cargo.toml FILES="benches/ examples/ src/ Cargo.toml README.md docs/" cargo publish --allow-dirty --token ${CRATES_TOKEN} zip -r blitzar-v$NEW_VERSION.zip $FILES tar -czvf blitzar-v$NEW_VERSION.tar.gz $FILES