1

I've been a Java dev for most of career. Currently branching out into frontend space with React. I'm unsure what the best practice is around the workflow in versioning my application from a development build to getting promoted to be a prod-ready build.

I want to follow the semantic versioning pattern of "major.minor.patch". The current workflow in place is as below:

  1. I make and push a change

  2. Jenkins job is triggered and on a successful run of unit tests, the build package is uploaded to Artifactory under the development/ directory and then, deployed to a test environment

  3. After QA is done on the test environment, I want to promote the build from Artifactory development/ to Artifactory production/.

  4. Jenkins job is triggered to deploy to the production environment

How should my application be versioned throughout the above lifecycle from 1 to 4? How can I use "npm version" to automate updating the version?

Let's say the initial version in my package.json is 0.0.1.

His
  • 5,891
  • 15
  • 61
  • 82
  • 1
    Are you asking how does semver work, or are you asking about how to bump the version number in package.json automatically? Generally speaking it's up to the developer to decide if something is a major, minor or patch level change. – AlexMA May 24 '19 at 11:46
  • Not asking how semver work. More asking about the best practice on how versioning is / should be done / automated with npm version given the lifecycle I mentioned above. For example, when I push my change to Git, the version is 0.0.1 and I do this multiple times, and the version is still at 0.0.1. When should I use npm version to say that this will be a minor release - should I do it before the build promotion or should I do it at the build promotion (no 3 above). – His May 24 '19 at 12:00
  • If they are public releases you should try your best to version them correctly. Perhaps branch off of a major minor or patch branch as appropriate when writing new code and teach the build tool to handle that. If the release is private, you can just append a -SNAPSHOT to the patch version or whatever else you would like to do. You may want to read https://github.com/semver/semver/issues/124. – AlexMA May 24 '19 at 12:10

0 Answers0