Skip to content

Commit

Permalink
Configure bumpver and release workflow
Browse files Browse the repository at this point in the history
  • Loading branch information
jdejaegh committed Feb 16, 2025
1 parent 225a853 commit 196d4cc
Show file tree
Hide file tree
Showing 6 changed files with 53 additions and 4 deletions.
27 changes: 27 additions & 0 deletions .github/workflows/release.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,27 @@
name: Create release

on:
push:
tags:
- '*.*.*'

permissions:
contents: write

jobs:
tests:
uses: ./.github/workflows/pytest.yml
release:
name: Release pushed tag
needs: [tests]
runs-on: ubuntu-22.04
steps:
- name: Create release
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
tag: ${{ github.ref_name }}
run: |
gh release create "$tag" \
--repo="$GITHUB_REPOSITORY" \
--title="${GITHUB_REPOSITORY#*/} ${tag#v}" \
--generate-notes
5 changes: 3 additions & 2 deletions custom_components/irm_kmi/api.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
import aiohttp
import async_timeout
from aiohttp import ClientResponse
from .const import USER_AGENT

_LOGGER = logging.getLogger(__name__)

Expand Down Expand Up @@ -70,9 +71,9 @@ async def _api_wrapper(
) -> any:
"""Get information from the API."""
if headers is None:
headers = {'User-Agent': 'github.com/jdejaegh/irm-kmi-ha'}
headers = {'User-Agent': USER_AGENT}
else:
headers['User-Agent'] = 'github.com/jdejaegh/irm-kmi-ha'
headers['User-Agent'] = USER_AGENT

try:
async with async_timeout.timeout(60):
Expand Down
2 changes: 2 additions & 0 deletions custom_components/irm_kmi/const.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,3 +159,5 @@
}

WEEKDAYS = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']

USER_AGENT: Final = 'github.com/jdejaegh/irm-kmi-ha 0.2.28'
2 changes: 1 addition & 1 deletion custom_components/irm_kmi/pollen.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
import xml.etree.ElementTree as ET
from typing import List

from custom_components.irm_kmi.const import POLLEN_LEVEL_TO_COLOR, POLLEN_NAMES
from .const import POLLEN_LEVEL_TO_COLOR, POLLEN_NAMES

_LOGGER = logging.getLogger(__name__)

Expand Down
18 changes: 18 additions & 0 deletions pyproject.toml
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
[tool.bumpver]
current_version = "0.2.28"
version_pattern = "MAJOR.MINOR.PATCH"
commit_message = "bump version {old_version} -> {new_version}"
tag_message = "{new_version}"
tag_scope = "default"
pre_commit_hook = ""
post_commit_hook = ""
commit = true
tag = true
push = true

[tool.bumpver.file_patterns]
"pyproject.toml" = [
'current_version = "{version}"',
]
"custom_components/irm_kmi/manifest.json" = ['"version": "{version}"']
"custom_components/irm_kmi/const.py" = ["'github.com/jdejaegh/irm-kmi-ha {version}'"]
3 changes: 2 additions & 1 deletion requirements_tests.txt
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,5 @@ homeassistant==2025.2.4
pytest_homeassistant_custom_component==0.13.214
pytest
freezegun
isort
isort
bumpver

0 comments on commit 196d4cc

Please sign in to comment.