First, you need to understand the rules for upgrading the versioning number. You can read more about the semantic version here.
Each version will have x.y.z version where it defines for different purpose as shown below.
To run the scripts, you can define it in your package.json.
"script": {
"buildmajor": "npm version major && ng build --prod",
"buildminor": "npm version minor && ng build --prod",
"buildpatch": "npm version patch && ng build --prod"
}
In your terminal, you just need to npm run accordingly to your needs like
npm run buildpatch
If run it in git repo, the default git-tag-version is true and if you do not wish to do so, you can add below command into your scripts:
--no-git-tag-version
for eg: "npm --no-git-tag-version version major && ng build --prod"