Skip to content

Commit

Permalink
Publish to PyPI immediately before pushing to main branch
Browse files Browse the repository at this point in the history
  • Loading branch information
sbidoul authored and legalsylvain committed Oct 25, 2024
1 parent f7dbd8a commit 7e08e7f
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions src/oca_github_bot/tasks/merge_bot.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
from enum import Enum

from .. import github
from ..build_wheels import build_and_check_wheel, build_and_publish_wheel
from ..build_wheels import build_and_publish_wheel
from ..config import (
GITHUB_CHECK_SUITES_IGNORED,
GITHUB_STATUS_IGNORED,
Expand Down Expand Up @@ -177,8 +177,12 @@ def _merge_bot_merge_pr(org, repo, merge_bot_branch, cwd, dry_run=False):
check_call(["git", "reset", "--soft", head_sha], cwd=cwd)
check_call(["git", "commit", "-m", "[BOT] post-merge updates"], cwd=cwd)

# We publish to PyPI before merging, because we don't want to merge
# if PyPI rejects the upload for any reason. There is a possibility
# that the upload succeeds and then the merge fails, but that should be
# exceptional, and it is better than the contrary.
for addon_dir in modified_installable_addon_dirs:
build_and_check_wheel(addon_dir)
build_and_publish_wheel(addon_dir, dist_publisher, dry_run)

if dry_run:
_logger.info(f"DRY-RUN git push in {org}/{repo}@{target_branch}")
Expand All @@ -188,11 +192,6 @@ def _merge_bot_merge_pr(org, repo, merge_bot_branch, cwd, dry_run=False):
["git", "push", "origin", f"{merge_bot_branch}:{target_branch}"], cwd=cwd
)

# build and publish wheel
if modified_installable_addon_dirs:
for addon_dir in modified_installable_addon_dirs:
build_and_publish_wheel(addon_dir, dist_publisher, dry_run)

# TODO wlc unlock modified_addons

# delete merge bot branch
Expand Down

0 comments on commit 7e08e7f

Please sign in to comment.