Configure bumpver and release workflow

This commit is contained in:
Jules 2025-02-16 13:25:49 +01:00
parent 225a853b27
commit 196d4cc178
Signed by: jdejaegh
GPG key ID: 99D6D184CA66933A
6 changed files with 53 additions and 4 deletions

27
.github/workflows/release.yml vendored Normal file
View file

@ -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

View file

@ -10,6 +10,7 @@ from datetime import datetime
import aiohttp
import async_timeout
from aiohttp import ClientResponse
from .const import USER_AGENT
_LOGGER = logging.getLogger(__name__)
@ -70,9 +71,9 @@ class IrmKmiApiClient:
) -> 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):

View file

@ -159,3 +159,5 @@ IRM_KMI_NAME: Final = {
}
WEEKDAYS = ['Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday', 'Sunday']
USER_AGENT: Final = 'github.com/jdejaegh/irm-kmi-ha 0.2.28'

View file

@ -3,7 +3,7 @@ import logging
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__)

18
pyproject.toml Normal file
View file

@ -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}'"]

View file

@ -2,4 +2,5 @@ homeassistant==2025.2.4
pytest_homeassistant_custom_component==0.13.214
pytest
freezegun
isort
isort
bumpver