Skip to content

Release

Release #46

Workflow file for this run

name: Release
on:
release:
types: [published]
permissions:
contents: write
jobs:
validate:
name: Validate before release
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.12", "3.13"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Install dependencies
run: |
python -m pip install --upgrade pip
pip install pytest pytest-asyncio pytest-cov freezegun homeassistant
- name: Set up importable package structure
run: |
mkdir -p /tmp/ha-config/custom_components
cp -r $GITHUB_WORKSPACE /tmp/ha-config/custom_components/solar_energy_management
- name: Run tests
working-directory: /tmp/ha-config
env:
PYTHONPATH: /tmp/ha-config
run: |
python -m pytest custom_components/solar_energy_management/tests/ \
-v --tb=short
release-info:
name: Release info
runs-on: ubuntu-latest
needs: validate
steps:
- uses: actions/checkout@v4
- name: Verify manifest version matches tag
run: |
TAG="${GITHUB_REF#refs/tags/v}"
MANIFEST=$(python3 -c "import json; print(json.load(open('manifest.json'))['version'])")
# Strip beta/rc suffix for comparison (v1.4.2-beta.1 → 1.4.2)
TAG_BASE="${TAG%%-*}"
MANIFEST_BASE="${MANIFEST%%-*}"
echo "Tag: $TAG (base: $TAG_BASE)"
echo "Manifest: $MANIFEST (base: $MANIFEST_BASE)"
if [ "$TAG_BASE" != "$MANIFEST_BASE" ]; then
echo "::error::Tag base version ($TAG_BASE) does not match manifest base version ($MANIFEST_BASE)"
exit 1
fi
- name: Annotate release type
run: |
TAG="${GITHUB_REF#refs/tags/}"
if [[ "$TAG" == *"-beta"* ]] || [[ "$TAG" == *"-rc"* ]]; then
echo "🧪 This is a **pre-release**. Enable 'Show beta versions' in HACS to receive this update." >> $GITHUB_STEP_SUMMARY
else
echo "🚀 Stable release published. All HACS users will receive this update." >> $GITHUB_STEP_SUMMARY
fi