Skip to content

Commit

Permalink
Remaster release version generation
Browse files Browse the repository at this point in the history
  • Loading branch information
Limych committed Mar 2, 2021
1 parent b9d1a87 commit 041dfc0
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 10 deletions.
10 changes: 3 additions & 7 deletions bin/gen_releasenotes
Original file line number Diff line number Diff line change
Expand Up @@ -3,11 +3,11 @@
import argparse
import logging
import os
import re
import subprocess
from datetime import datetime
from typing import List

from awesomeversion.match import is_pep440
from github import Github, GithubException, Repository, Tag
from packaging.version import Version

Expand Down Expand Up @@ -54,13 +54,9 @@ def get_commits(repo: Repository, since: datetime, until: datetime):

def get_release_tags(repo: Repository) -> List[Tag.Tag]:
"""Get list of all release tags from repository."""
reg = re.compile(
r"^v?[0-9]+\.[0-9]+(?:\.[0-9]+)?"
r"(?:[._-]?[A-Za-z]*[._-]?[0-9]*)?"
r"(?:[._-]?dev[0-9]*)?"
r"(?:-[0-9A-Za-z-]+(?:\.[0-9A-Za-z-]+)*)?(?:\+[0-9A-Za-z-]+)?$"
tags = list(
filter(lambda tag: is_pep440(tag.name.lstrip("v")), list(repo.get_tags()))
)
tags = list(filter(lambda tag: re.match(reg, tag.name), list(repo.get_tags())))
tags.sort(key=lambda x: x.name.lstrip("v"), reverse=True)
_LOGGER.debug("Found tags: %s", tags)
return tags
Expand Down
4 changes: 2 additions & 2 deletions bin/release
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,6 @@ git commit -a --no-verify -m "Bump version"
git tag -a "$new" -m "v$new"
log.info "Commit tagged as v$new"

log.info "Patch files to version '${new}+dev'..."
sed -i -E "s/(^VERSION = \")[^\"]*/\\1${new}+dev/" ${const_path}
log.info "Patch files to version '${new}.dev0'..."
sed -i -E "s/(^VERSION = \")[^\"]*/\\1${new}.dev0/" ${const_path}
./bin/update_manifest
2 changes: 1 addition & 1 deletion tests/test_config_flow.py
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
"""Test integration_blueprint config flow."""
from unittest.mock import patch

from homeassistant import config_entries, data_entry_flow
import pytest
from homeassistant import config_entries, data_entry_flow
from pytest_homeassistant_custom_component.common import MockConfigEntry

from custom_components.integration_blueprint.const import (
Expand Down

0 comments on commit 041dfc0

Please sign in to comment.