Skip to content

Commit

Permalink
Nightly only
Browse files Browse the repository at this point in the history
  • Loading branch information
romainthomas committed Dec 10, 2024
1 parent f8f4bb7 commit 3fcdbdc
Showing 1 changed file with 11 additions and 29 deletions.
40 changes: 11 additions & 29 deletions .github/deploy.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,43 +250,25 @@ def is_main_branch(self, name: str) -> bool:
return name in self._main_branches

def should_be_deployed(self, branch: str) -> bool:
if GithubDeploy.is_tagged():
return True

if any(re.match(s, branch) for s in self._branches):
return True

if any(branch.startswith(e) for e in RELEASE_KEYWORD):
return True

return False

def deploy(self, directories: list[str]):
s3dir = None
tag = None
if GithubDeploy.is_tagged():
s3dir = GithubDeploy.tag_name()
tag = s3dir if len(s3dir) > 0 else None
logger.info("Deployment for tag: %s", tag)
else:
branch = GithubDeploy.branch()
if branch is None:
logger.warning("Can't resolve the branch name")
sys.exit(1)

for rel_kwrd in RELEASE_KEYWORD:
if branch.startswith(rel_kwrd):
_, s3dir = branch.split(rel_kwrd)
if s3dir is None:

if self.is_main_branch(branch):
s3dir = self._default_dir
else:
s3dir = branch.replace("/", "-").replace("_", "-")

if not self.should_be_deployed(branch):
logger.info("Skipping deployment for branch: %s", branch)
return
branch = GithubDeploy.branch()

if branch is None:
logger.warning("Can't resolve the branch name")
sys.exit(1)

s3dir = self._default_dir

if not self.should_be_deployed(branch):
logger.info("Skipping deployment for branch: %s", branch)
return

if s3dir is None:
logger.error("Target directory is not set")
Expand Down

0 comments on commit 3fcdbdc

Please sign in to comment.