Mostly taken from https://www.cyberciti.biz/faq/update-upgrade-debian-11-to-debian-12-bookworm/
Doing less checks than that, to make it as much of a copy and paste affair as possible.
sudo apt update
sudo apt upgrade -y
sudo apt full-upgrade -y
sudo apt autoremove --purge -y
sudo systemctl reboot
sudo cp -v /etc/apt/sources.list /root/sources.list-backup.11.bullseye
sudo sed -i'.bak' 's/bullseye/bookworm/g' /etc/apt/sources.list
sudo apt update
sudo apt upgrade --without-new-pkgs -y
sudo apt full-upgrade -y