1. Have a thing like `%%VERSION%%` in: plugin headers, README.txt|md, package.json, and in the main plugin file have a constant `define('MYPLUGIN_VERSION', '%%VERSION%%')`
2. Have a GitHub action triggered on tag push that replaces the version before deployment, see https://gist.github.com/gmazzap/ed7a305d55adc7e0238fffa6d66b829d
- Have code like this to simplify development using the non-built version: see https://3v4l.org/YaGJg
Disclaimer: none of the code shared above is tested :)