Versionist update versions

Hi all,

I’m using Versionist for the versioning of my Node.js packages using GitHub Actions. I’ve created a “concept” GitHub Action (asked permission but didn’t get a response so far, so let me know if you’re okay with this!). I saw there was a GitHub Action for Balena Versionist, but I thought that’s more for Balena itself.

Great library by the way and very intuitive in how to use it!

For my Node.js packages, this works great!
But I’m also creating multi-container applications in a monorepo. So my directory structure is as follows:

- redis/ (Redis container)
  - Dockerfile.template
  - redis.conf
- application/ (Node.js application)
  - Dockerfile.template
  - src/
  - package.json
  - package-lock.json
  - etc...
- docker-compose.yml

It’d be ideal if Versionist creates a changelog and version for this monorepo as well. I can use the ‘update-version-file’ type, but is it also possible to create a VERSION file and update the version in application/package.json?

I’ve seen the mixed type, but afaik it only supports one working directory, so not a working directory for type ‘npm’ and for type ‘update-version-file’.

My main objective is to create a version for the whole monorepo with a changelog and having access inside the application container (or all containers) to that version, so I can use it inside the application.

Thanks in advance!

Hi there! First of all, thank you for the positive feedback and glad to hear you’re enjoying Versionist.

Something that was not clear to me. Do you want to have different independent versions for your monorepo apps (redis, application etc)? If that is the case, versionist cannot support that I am afraid and is not designed for this case. It is using the git log of the repo to calculate the versions and update the various files.

Just an idea, a way to achieve this would be breaking your apps to different repos and then use submodules. Then you can have your action running versionist on those directories.

If you want to keep the same version across all projects, then I believe it is possible to configure it like that, as you mentioned, by writing some config code and tell versionist where your files are.

1 Like

Hi Stathis,

Thanks for your reaction. And thank you for Versionist :slight_smile:

I don’t want independent versions for my monorepo apps. I can achieve that by using multiple repositories as you suggested. I want 1 version for the whole monorepo, because that’s being used as a release for Balena. But, preferably, I want the version to be changed in the package.json in one (or more) of my containers that are in a subdirectory.

But most of all, I want to access the version that’s being created inside my container, so I can notify my server that device X is running software version Y.

About the config code you suggested, can you point me in the right direction for that?

Thanks in advance!

Hey! As you realized, versionist does not support updating files at multiple directories. I believe the way to do this is by writing your own updateVersion function in the versionist.conf.js

1 Like