update_collab_rev.sh 880 B

1234567891011121314151617181920212223242526272829303132333435
  1. #!/bin/bash
  2. # Ensure a new revision ID is provided
  3. if [ "$#" -ne 1 ]; then
  4. echo "Usage: $0 <new_revision_id>"
  5. exit 1
  6. fi
  7. NEW_REV="$1"
  8. echo "New revision: $NEW_REV"
  9. directories=("rust-lib" "appflowy_tauri/src-tauri")
  10. for dir in "${directories[@]}"; do
  11. echo "Updating $dir"
  12. cd "$dir"
  13. sed -i.bak "/^collab[[:alnum:]-]*[[:space:]]*=/s/rev = \"[a-fA-F0-9]\{6,40\}\"/rev = \"$NEW_REV\"/g" Cargo.toml
  14. # Detect changed crates
  15. collab_crates=($(grep -E '^collab[a-zA-Z0-9_-]* =' Cargo.toml | awk -F'=' '{print $1}' | tr -d ' '))
  16. # Update only the changed crates in Cargo.lock
  17. crates_to_update=""
  18. for crate in "${collab_crates[@]}"; do
  19. crates_to_update="$crates_to_update -p $crate"
  20. done
  21. # Update all the specified crates at once
  22. echo "Updating crates: $crates_to_update"
  23. cargo update $crates_to_update
  24. cd ..
  25. done