dbbs-lab / bsb-core

The Brain Scaffold Builder
https://bsb.readthedocs.io
GNU General Public License v3.0
21 stars 16 forks source link

feat: add conventional commits and auto release #864

Closed drodarie closed 1 month ago

drodarie commented 1 month ago

Describe the work done

With this PR, we introduce conventional commits together with a pipeline to automatize a release workflow triggered by push on the main branch This includes:

Slight drawback with the new system: certain git actions like merging branches produces an automatic commit message which is not matching the commit convention. This will require the user to manually write these commit messages.

Added developer guidelines to documentation

List which issues this resolves:

Closes #860


📚 Documentation preview 📚: https://bsb--864.org.readthedocs.build/en/864/

drodarie commented 1 month ago

If this PR works, we might want to drop bump-my-version

filimarc commented 1 month ago

Sorry, seemed that with my last commit the changes are not correctly pushed

Helveg commented 1 month ago

@drodarie status update? Is this ready to merge? Have you tested this workflow on another repository? Does it work? :)

drodarie commented 1 month ago

Hi @Helveg, yes the pipeline should be ready to be merged (although it is difficult to test Githib Actions that triggers on the master branch). I created a test repository on my account here with the same Github Actions pipeline: https://github.com/drodarie/test_actions

Helveg commented 1 month ago

Ok, if you can confirm that in that test repository the following things happen, then I'm willing to merge and see what happens:

drodarie commented 1 month ago

The appropriate next semver is calculated from the conventional commits

Yes look at the logs of Get Next Version from this run or this one

This next semver is bumped by bump_my_version in the Python source code, [...]

Yes, look at the logs of Bump version in Python project from this run An automatic commit will be pushed and tagged with the change of version but at this stage the changelog is not updated because we need the new tag to be pushed (see logs in Commit version change and action-create-tag from the run).

Then, the actions automatically create a changelog from the code changed between the tags (Update CHANGELOG from this run), they produce a Github release (Create Release from the run) and commit the changes to CHANGELOG.md (Commit CHANGELOG.md from the run).

So technically it is done in 2 commits but we need the tag for the release and it has to be attached to the bump-my-version commit. During this whole procedure, no other CI action will be triggered (no action is triggered by an action).

The artifact is built and deployed to PyPI

This part is not fully working in my test case because there is already a test-actions python library on test-pypi and so my action is failing but the logs show that it contacts the server.