Skip to content

Commit

Permalink
Improved 'make release' to allow repetiton in case of failures
Browse files Browse the repository at this point in the history
Signed-off-by: Andreas Maier <maiera@de.ibm.com>
  • Loading branch information
andy-maier committed Jul 11, 2024
1 parent 999022f commit aeb4922
Show file tree
Hide file tree
Showing 2 changed files with 25 additions and 14 deletions.
6 changes: 2 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -494,16 +494,14 @@ release:
@bash -c 'if [[ "$${VERSION#*.*.}" == "0" ]]; then echo master >branch.tmp; else echo stable_$${VERSION%.*} >branch.tmp; fi'
@bash -c 'if [ -n "$$(git tag -l $(VERSION))" ]; then echo ""; echo "Error: Version tag $(VERSION) already exists (the version has already been released)"; echo ""; false; fi'
@bash -c 'if [ -z "$$(git branch --contains $(VERSION)a0 $$(cat branch.tmp))" ]; then echo ""; echo "Error: Release start tag $(VERSION)a0 is not in target branch $$(cat branch.tmp), but in:"; echo ""; git branch --contains $(VERSION)a0;. false; fi'
@bash -c 'if [ -n "$$(git branch -l release_$(VERSION))" ]; then echo ""; echo "Error: Release branch release_$(VERSION) already exists (the release of the version is already underway)"; echo ""; false; fi'
@echo "==> This will release $(package_name) version $(VERSION) to PyPI using target branch $$(cat branch.tmp)"
@echo -n '==> Continue? [yN] '
@bash -c 'read answer; if [ "$$answer" != "y" ]; then echo "Aborted."; false; fi'
bash -c 'git checkout $$(cat branch.tmp)'
git pull
git checkout -b release_$(VERSION)
@bash -c 'if [ -n "$$(git branch -l release_$(VERSION))" ]; then echo "Creating release branch release_$(VERSION)"; git checkout -b release_$(VERSION); fi'
git checkout release_$(VERSION)
make authors
safety check --policy-file $(safety_develop_policy_file) -r minimum-constraints-develop.txt --full-report
safety check --policy-file $(safety_install_policy_file) -r minimum-constraints-install.txt --full-report
towncrier build --version $(VERSION) --yes
git commit -asm "Release $(VERSION)"
git push --set-upstream origin release_$(VERSION)
Expand Down
33 changes: 23 additions & 10 deletions docs/development.rst
Original file line number Diff line number Diff line change
Expand Up @@ -806,20 +806,33 @@ local clone of the python-zhmcclient Git repo.
milestones to a future version, and proceed with the release process. You
may need to create the milestone for the future version.

2. Create and push the release branch:
2. Run the Safety tool:

.. code-block:: sh
RUN_TYPE=release make safety
If any of the two safety runs fails, fix the safety issues that are reported,
in a separate branch/PR.

3. Create and push the release branch:

.. code-block:: sh
VERSION=M.N.U make release
This includes the following steps:

* finalize the change log
* create the release branch (``release_M.N.U``), if not yet existing
* make sure the AUTHORS.md file is up to date
* run the safety tool in release mode
* push the release branch (``release_M.N.U``)
* update the change log from the change fragment files, and delete those
* commit the changes to the release branch
* push the release branch

If this command fails, the fix can be committed to the release branch
and the command above can be retried.

3. On GitHub, create a Pull Request for the release branch ``release_M.N.U``.
4. On GitHub, create a Pull Request for the release branch ``release_M.N.U``.

Important: When creating Pull Requests, GitHub by default targets the
``master`` branch. When releasing based on a stable branch, you need to
Expand All @@ -834,19 +847,19 @@ local clone of the python-zhmcclient Git repo.
tests for all defined environments, since it discovers by the branch name
that this is a PR for a release.

4. On GitHub, once the checks for that Pull Request have succeeded, merge the
5. On GitHub, once the checks for that Pull Request have succeeded, merge the
Pull Request (no review is needed). This automatically deletes the branch
on GitHub.

If the PR did not succeed, fix the issues.

5. On GitHub, close milestone ``M.N.U``.
6. On GitHub, close milestone ``M.N.U``.

Verify that the milestone has no open items anymore. If it does have open
items, investigate why and fix. If the milestone does not have open items
anymore, close the milestone.

6. Publish the package
7. Publish the package

.. code-block:: sh
Expand All @@ -862,7 +875,7 @@ local clone of the python-zhmcclient Git repo.
Github, and finally creates a new stable branch on Github if the master
branch was released.

7. Verify the publishing
8. Verify the publishing

Wait for the "publish" workflow for the new release to have completed:
https://github.com/zhmcclient/python-zhmcclient/actions/workflows/publish.yml
Expand Down Expand Up @@ -891,7 +904,7 @@ local clone of the python-zhmcclient Git repo.
and edit the new version and set it to "active" (normally, that is done
automatically by ReadTheDocs for new tags).

8. Hide previous fix version on ReadTheDocs
9. Hide previous fix version on ReadTheDocs

When releasing a fix version != 0 (e.g. M.N.1), log on to
https://readthedocs.org/ and go to
Expand Down

0 comments on commit aeb4922

Please sign in to comment.