Files
motion_light/.gitea/workflows/release.yml
T
sirmrak 8c4009dc82
HA Integration Release / Validate HA Integration (push) Successful in 3s
HA Integration Release / Semantic Release (push) Failing after 15s
Обновить .gitea/workflows/release.yml
2026-07-09 13:31:39 +03:00

109 lines
3.7 KiB
YAML

name: HA Integration Release
on:
push:
branches:
- main
- master
env:
GIT_SSL_NO_VERIFY: true
jobs:
validate:
name: Validate HA Integration
runs-on: ubuntu-latest
steps:
- name: Checkout repository
uses: actions/checkout@v4
- name: Validate integration structure
run: |
echo "🔍 Проверяем структуру интеграции..."
# Проверяем наличие директории интеграции
if [ ! -d "custom_components/motion_light" ]; then
echo "❌ Ошибка: директория custom_components/motion_light не найдена!"
exit 1
fi
# Проверяем наличие обязательных файлов
for file in "__init__.py" "manifest.json"; do
if [ ! -f "custom_components/motion_light/$file" ]; then
echo "❌ Ошибка: файл $file не найден!"
exit 1
fi
done
echo "✅ Все обязательные файлы на месте."
# Валидируем manifest.json
python3 << 'EOF'
import json
import sys
manifest_path = "custom_components/motion_light/manifest.json"
try:
with open(manifest_path) as f:
manifest = json.load(f)
except json.JSONDecodeError as e:
print(f"❌ Ошибка валидации JSON: {e}")
sys.exit(1)
# Проверяем обязательные поля для HA
required_fields = ['domain', 'name', 'version', 'documentation', 'codeowners', 'iot_class']
missing = [f for f in required_fields if f not in manifest]
if missing:
print(f"❌ Отсутствуют обязательные поля в manifest.json: {', '.join(missing)}")
sys.exit(1)
# Проверяем соответствие domain и имени директории
if manifest['domain'] != 'motion_light':
print(f"❌ Domain '{manifest['domain']}' не совпадает с именем директории 'motion_light'!")
sys.exit(1)
# Проверяем формат версии (semver)
version = manifest['version']
parts = version.split('.')
if len(parts) != 3 or not all(p.isdigit() for p in parts):
print(f"⚠️ Предупреждение: версия '{version}' не соответствует формату SemVer (X.Y.Z)")
print(f"✅ manifest.json валиден. Версия: {version}, Domain: {manifest['domain']}")
EOF
echo "🎉 Валидация успешно пройдена!"
release:
name: Semantic Release
needs: validate
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- name: Checkout repository
uses: actions/checkout@v4
with:
fetch-depth: 0
token: ${{ secrets.PAT_TOKEN }}
- name: Set up Python
uses: actions/setup-python@v5
with:
python-version: "3.11"
cache: 'pip'
- name: Install dependencies
run: pip install python-semantic-release
- name: Configure Git
run: |
git config --local user.email "actions@gitea.local"
git config --local user.name "Gitea Actions Bot"
- name: Run Semantic Release
env:
GITEA_TOKEN: ${{ secrets.PAT_TOKEN }}
run: semantic-release version