My team has multiple low level and high level packages written in Python and they are dependent on each other, we typically install them as GitHub repositories using pip
. Basically, I would like to automate the process of providing versions to the libraries, so the production code is easier to manage and rollback to previous versions in case of emergency.
Right now, we use a version string in the code and git tags to annotate the releases. By using commitizen's cz bump --changelog
we can manually update the versions in the file and when PR is approved and merged (due to main branch protection rules), the tag can be pushed too.
I've been trying to find a way to automate the process and I've encountered multiple problems along the way.
- The
commitizen-action
is almost perfect. But, since we have main branch protection in place, a PAT and dedicated user to bypass the rules are needed. Since I'm not an admin of our organisation, adding the tokens to every repository and rotation of tokens aren't very efficient. Is there a way to circumvent that so we, as a team, can manage our repositories? - I tried to write a custom GitHub Action executing
cz bump --changelog
when a pull request is created, so everything is still being done on the current feature branch. But then some commits after a PR review still can be pushed to the branch and the tag will point to the previous version of the code. I couldn't find a way to execute an Action just before merging the branch into main which theoretically would be something I need. - Maybe I am missing something? Is there a way to automatically and efficiently version Python packages and release them? We also use CircleCi, but I guess we still need the tokens to push to main. We've been thinking about our private package storage, are there any tools like that e.g. on Azure?
Edit: I'm also open to different approaches to versioning our releases and deployment approaches.