I have read a little bit about using semver for contrib modules in the updated documentation Transitioning from 8.x-* to semantic versioning and Drupal.org release version numbers allow semantic versioning. While I do understand that we need to tag these branches & releases incrementally based on your current 8.x version, how is this taken into practise?

My module for example is considered compatible for both Drupal 8 and 9, tagged with a release 8.x-2.1 on branch 8.x-2.x. So would I switch to a new branch 3.x and tag 3.0.0, or can this tag be on the same 8.x-2.x branch as they are essentially running the same codebase? Otherwise I have to apply all bug fixes and changes onto 2 branches.

How would this work in conjunction with the core_version_requirement key, as I believe semver is only supported starting from Drupal 8.7.7 core version?

And finally if I am able to use the same codebase for either semver or without, how would this work with update hooks or are they maintaining the same format?


I wouldn't use semantic versioning just for the sake of using it, especially since using it on drupal.org forces you to increase the major version number. Changing major version number means the new version is not compatible with the previous one, which also means the codebase diverges significantly (or it will diverge significantly).

core_version_requirement key require Drupal 8.7.7, while semantic versioning requires Drupal 8.8.3, as previous Drupal versions don't handle them, which means that if you are semantic versioning, you should also use core_version_requirement in the .info.yml file.
Using core_version_requirement doesn't change how semantic versioning works, and using semantic versioning doesn't change how core_version_requirement works, except that with semantic versioning I would set core_version_requirement to ^8.8.3 || ^9, at least.

| improve this answer | |
  • Support for contributed module semantic versioning wasn't added into Drupal core until Drupal 8.8.3. – anonymous May 10 at 21:25
  • Yes, that is clearly stated in Release naming conventions the OP linked. I don't know how I got confused. – kiamlaluno May 10 at 22:51
  • Thanks @kiamlaluno for the great summary! – baikho May 20 at 19:10

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.