Удалить .gitea/workflows/release.yml
This commit is contained in:
@@ -1,166 +0,0 @@
|
|||||||
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 "✅ Все обязательные файлы на месте."
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
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)
|
|
||||||
|
|
||||||
if manifest['domain'] != 'motion_light':
|
|
||||||
print(f"❌ Domain '{manifest['domain']}' не совпадает с именем директории 'motion_light'!")
|
|
||||||
sys.exit(1)
|
|
||||||
|
|
||||||
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: Install Gitea SSL certificate
|
|
||||||
run: |
|
|
||||||
echo "🔐 Устанавливаем SSL сертификат Gitea..."
|
|
||||||
|
|
||||||
apt-get update -qq
|
|
||||||
apt-get install -y -qq ca-certificates openssl curl > /dev/null 2>&1
|
|
||||||
|
|
||||||
mkdir -p /usr/local/share/ca-certificates
|
|
||||||
|
|
||||||
echo "📥 Скачиваем сертификат с 192.168.200.208:3000..."
|
|
||||||
echo | openssl s_client -connect 192.168.200.208:3000 -servername 192.168.200.208 2>/dev/null | openssl x509 > /tmp/gitea.crt
|
|
||||||
|
|
||||||
if [ ! -s /tmp/gitea.crt ]; then
|
|
||||||
echo "❌ Не удалось получить сертификат через openssl, пробуем альтернативный способ..."
|
|
||||||
openssl s_client -showcerts -connect 192.168.200.208:3000 </dev/null 2>/dev/null | openssl x509 -outform PEM > /tmp/gitea.crt
|
|
||||||
fi
|
|
||||||
|
|
||||||
if [ ! -s /tmp/gitea.crt ]; then
|
|
||||||
echo "❌ Не удалось получить сертификат!"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
echo "✅ Сертификат получен:"
|
|
||||||
head -3 /tmp/gitea.crt
|
|
||||||
|
|
||||||
cp /tmp/gitea.crt /usr/local/share/ca-certificates/gitea.crt
|
|
||||||
|
|
||||||
echo "🔄 Обновляем хранилище сертификатов..."
|
|
||||||
update-ca-certificates
|
|
||||||
|
|
||||||
echo "✅ Сертификат установлен в доверенные!"
|
|
||||||
ls -la /usr/local/share/ca-certificates/gitea.crt
|
|
||||||
|
|
||||||
echo "🧪 Тестируем HTTPS подключение..."
|
|
||||||
curl -I https://192.168.200.208:3000 && echo "✅ HTTPS подключение работает!" || echo "⚠️ curl test completed with warnings"
|
|
||||||
|
|
||||||
- name: Run Semantic Release
|
|
||||||
env:
|
|
||||||
GITEA_TOKEN: ${{ secrets.PAT_TOKEN }}
|
|
||||||
PYTHONHTTPSVERIFY: "0"
|
|
||||||
CURL_CA_BUNDLE: ""
|
|
||||||
REQUESTS_CA_BUNDLE: ""
|
|
||||||
SSL_CERT_FILE: ""
|
|
||||||
run: |
|
|
||||||
cat > /tmp/run_semantic_release.py << 'PYEOF'
|
|
||||||
import os
|
|
||||||
import sys
|
|
||||||
import ssl
|
|
||||||
|
|
||||||
ssl._create_default_https_context = ssl._create_unverified_context
|
|
||||||
|
|
||||||
os.environ['PYTHONHTTPSVERIFY'] = '0'
|
|
||||||
os.environ['CURL_CA_BUNDLE'] = ''
|
|
||||||
os.environ['REQUESTS_CA_BUNDLE'] = ''
|
|
||||||
os.environ['SSL_CERT_FILE'] = ''
|
|
||||||
|
|
||||||
try:
|
|
||||||
import urllib3
|
|
||||||
urllib3.disable_warnings(urllib3.exceptions.InsecureRequestWarning)
|
|
||||||
except:
|
|
||||||
pass
|
|
||||||
|
|
||||||
from semantic_release.cli import main
|
|
||||||
sys.exit(main())
|
|
||||||
PYEOF
|
|
||||||
|
|
||||||
python3 /tmp/run_semantic_release.py version
|
|
||||||
Reference in New Issue
Block a user