Auto incrementing semantic version numbers for Python project

My company distributes our Python app to customers using Python Egg files which they run on premise.

Using the deploy section in the circle.yml configuration we’d like to increment the minor version of the release for each egg file we build. So v17.02.01 -> v17.02.02 and when major version is changed we could start the count back at zero.

The major version can be set in the code, but Circle environment variables don’t give me much to work with. $CIRCLE_BUILD_NUM is a global counter for all builds and doesn’t satisfy the requirement of resetting when we go to our next version.

The only two options in my mind are:

  1. Parse egg files in artifacts cache for the last build then increment. Though I’m pretty sure artifacts are unique to each build not a persistent directory shared between them all.
  2. Run a Redis server or some other micro service where I keep a counter for each major version and ping that from my ./build.sh script.

I feel like a common thing to do but I’ve not found any writing on it.

1 Like

Are these egg files being hosted somewhere? You could you check against that if they are.