Bash is not a great cross-platform choice. Too many subtle differences.
The best way is a scripting language with locked-down dependency spec inside the script. Weirdly .NET is leading the way here.
Python with uv seems decent in here too.
Python with uv seems decent in here too.