Problems generating .deb from source code

I am trying to generate the .deb from the source code and the version of the generated .deb does not match the version that is in git.

How do you create the deb package and how do you find that does not match?

the version are not the same, for example when I build the .deb file de version is 1.0.1-1 and the lasted is 2.0.5390

This is cause you are not setting it. In the current scheme for versioning for those packages we had chosen to follow the ci build_number, and this is set in our ci, one or few commits trigger the build automatically and we use the incrementing build number and that is set from the ci that builds it.

How do I configure it

REV=$(git log --pretty=format:'%h' -n 1)
dch -v "$VERSION-1" "Build from git. $REV"
dch -D unstable -r ""

dpkg-buildpackage -A -rfakeroot -us -uc

This is what we have in ci.

sorry but i still get the same result