Alexandre Pasmantier b1fe0182f8
fix(cargo workspace): fix cargo workspace structure and dependencies (#15)
* fix(cargo workspace): fix cargo workspace dependencies

* add bump and publish scripts

* more version automation scripts
2024-11-11 20:31:22 +01:00

21 lines
700 B
Bash
Executable File

#!/bin/bash
set -euo pipefail
# get new version
NEW_VERSION=$(python scripts/get_version.py)
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && pwd )"
cd $SCRIPT_DIR/..
echo "Bumping version in workspace crates: $NEW_VERSION"
TOML_FILES="$(git ls-files 'crates/television-*/Cargo.toml')"
perl -pi -e "s/^version .*= .*\$/version = \"$NEW_VERSION\"/" -- $TOML_FILES
perl -pi -e "s/^(television-[a-z]+)\\s*=\\s*{.*\$/\\1 = { path = \"..\/\\1\", version = \"$NEW_VERSION\" }/" -- $TOML_FILES
echo "Bumping root Cargo.toml dependencies to $NEW_VERSION"
perl -pi -e "s/^(television-[a-z]+)\\s*=\\s*{.*\$/\\1 = { path = \"crates\/\\1\", version = \"$NEW_VERSION\" }/" -- Cargo.toml
echo "Done"