- PORTING_STATUS.yaml : source de vérité canal APT + placement nav - scripts/gen_device_reference.py : génération matrice + fiches + SUMMARY.md depuis integrationplugin*.json + meta.json ; nightly sans JSON = invisible - mkdocs.yml : plugin literate-nav, nav 6 sections, Appareils via SUMMARY.md - .gitea/workflows/docs.yml : CI complet — fetch JSON (branche auto-détectée), génération, build --strict, check idempotence, rsync deploy - Badges HTML (stable/testing/nightly + consumer/community + ok/part/road) - Fiches appareils : Eastron, ABB B2x, ABB Terra, Keba, Waveshare - requirements.txt : mkdocs-material, mkdocs-literate-nav, PyYAML Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
95 lines
3.8 KiB
YAML
95 lines
3.8 KiB
YAML
name: Build & Deploy docs
|
|
|
|
on:
|
|
push:
|
|
branches: [main]
|
|
schedule:
|
|
- cron: '0 3 * * *' # mise à jour nocturne (meta.json des repos plugins)
|
|
workflow_dispatch:
|
|
|
|
jobs:
|
|
build-deploy:
|
|
runs-on: ubuntu-latest
|
|
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Setup Python
|
|
uses: actions/setup-python@v5
|
|
with:
|
|
python-version: "3.11"
|
|
|
|
- name: Install dependencies
|
|
run: pip install -r requirements.txt
|
|
|
|
# ── Récupération des JSON depuis les 5 repos drivers ─────────────────
|
|
- name: Fetch plugin JSON files
|
|
env:
|
|
GITEA_TOKEN: ${{ secrets.MKDOCS_TOKEN }}
|
|
run: |
|
|
GITEA_BASE="https://git.etm-powersync.fr"
|
|
AUTH_BASE="https://pakutz79:${GITEA_TOKEN}@git.etm-powersync.fr"
|
|
mkdir -p .plugins-src
|
|
|
|
for repo in etm-powersync-plugins etm-powersync-plugins-modbus \
|
|
nymea-plugins nymea-plugins-modbus nymea-generic; do
|
|
|
|
# Branche par défaut via API Gitea (pas de hardcoding main/master)
|
|
BRANCH=$(curl -sf \
|
|
-H "Authorization: token ${GITEA_TOKEN}" \
|
|
"${GITEA_BASE}/api/v1/repos/ETM-Schurig/${repo}" \
|
|
| python3 -c "import sys,json; d=json.load(sys.stdin); print(d.get('default_branch','main'))" \
|
|
2>/dev/null) || BRANCH="main"
|
|
|
|
echo "→ ${repo} (branche: ${BRANCH})"
|
|
git clone --depth 1 --branch "${BRANCH}" \
|
|
"${AUTH_BASE}/ETM-Schurig/${repo}.git" \
|
|
".plugins-src/${repo}" \
|
|
|| echo "WARNING: ${repo} introuvable ou inaccessible — ignoré"
|
|
done
|
|
|
|
# ── Génération de la doc ──────────────────────────────────────────────
|
|
- name: Generate device reference + SUMMARY.md
|
|
run: |
|
|
python3 scripts/gen_device_reference.py \
|
|
--src .plugins-src \
|
|
--docs docs \
|
|
--lang fr
|
|
|
|
# ── Build MkDocs ──────────────────────────────────────────────────────
|
|
- name: MkDocs build --strict
|
|
run: mkdocs build --strict
|
|
|
|
# ── Vérification idempotence ──────────────────────────────────────────
|
|
- name: Check generated content is up-to-date
|
|
run: |
|
|
python3 scripts/gen_device_reference.py \
|
|
--src .plugins-src \
|
|
--docs docs \
|
|
--lang fr \
|
|
--check
|
|
|
|
# ── SSH ───────────────────────────────────────────────────────────────
|
|
- name: Setup SSH deploy key
|
|
env:
|
|
SSH_KEY: ${{ secrets.DOCS_DEPLOY_SSH_KEY }}
|
|
DEPLOY_HOST: ${{ secrets.DOCS_DEPLOY_HOST }}
|
|
run: |
|
|
mkdir -p ~/.ssh
|
|
printf '%s\n' "${SSH_KEY}" > ~/.ssh/deploy_key
|
|
chmod 600 ~/.ssh/deploy_key
|
|
ssh-keyscan -H "${DEPLOY_HOST}" >> ~/.ssh/known_hosts
|
|
|
|
# ── Déploiement ───────────────────────────────────────────────────────
|
|
- name: Deploy via rsync
|
|
env:
|
|
DEPLOY_USER: ${{ secrets.DOCS_DEPLOY_USER }}
|
|
DEPLOY_HOST: ${{ secrets.DOCS_DEPLOY_HOST }}
|
|
DEPLOY_PATH: ${{ secrets.DOCS_DEPLOY_PATH }}
|
|
run: |
|
|
rsync -az --delete \
|
|
-e "ssh -i ~/.ssh/deploy_key -o StrictHostKeyChecking=yes" \
|
|
site/ \
|
|
"${DEPLOY_USER}@${DEPLOY_HOST}:${DEPLOY_PATH}"
|