workflows/authelia.yaml hinzugefügt
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
2026-01-11 16:03:50 +01:00
parent 61f7e781e4
commit a1cd5c0cc4

74
workflows/authelia.yaml Normal file
View File

@@ -0,0 +1,74 @@
name: Authelia Update Check
on:
push:
workflow_dispatch:
inputs:
args:
description: 'Argumente für das Script'
required: false
default: ''
schedule:
- cron: '0 4 * * *' # Täglich um 4 Uhr morgens
jobs:
check-and-notify:
runs-on: ubuntu-latest # Oder dein eigener Gitea-Runner
steps:
- name: SSH Execution and Logic
id: ssh_step
uses: appleboy/ssh-action@v1.0.3
with:
host: 10.0.4.18
username: root
password: ${{ secrets.PASSWORD_AUTHELIA }}
port: 22
# Wir übergeben die UI-Inputs oder leere Strings
envs: ARGS
env:
ARGS: ${{ github.event.inputs.args }}
script: |
fetch -o /tmp/authelia-update.sh https://git.familie-berner.de/Open/infra-maintenance/raw/branch/main/authelia/authelia-update.sh
chmod +x /tmp/authelia-update.sh
set +e
timeout 10m /tmp/authelia-update.sh $ARGS
EXIT_CODE=$?
set -e
case $EXIT_CODE in
0) MSG="✅ Update erfolgreich / Alles aktuell" ;;
10) MSG=" Update verfügbar, aber nicht angewendet" ;;
64) MSG="❌ Fehler: Ungültige Parameter" ;;
69) MSG="🌐 Fehler: Netzwerk/GitHub nicht erreichbar" ;;
70) MSG="📂 Fehler: Authelia Binary nicht gefunden" ;;
72) MSG="↩ Fehler: Kein Backup gefunden" ;;
75) MSG="🔥 KRITISCH: Dienst startet nicht!" ;;
*) MSG="❓ Unbekannter Fehler (Code: $EXIT_CODE)" ;;
esac
# Der Trick für Gitea Actions: Wir schreiben den Text in den GITHUB_OUTPUT
echo "status_msg=$MSG" >> $GITHUB_OUTPUT
echo "exit_code=$EXIT_CODE" >> $GITHUB_OUTPUT
# Wenn es ein echter Fehler ist (>10), lassen wir den Step fehlschlagen
if [ $EXIT_CODE -ne 0 ] && [ $EXIT_CODE -ne 10 ]; then exit $EXIT_CODE; fi
- name: Matrix Notification
# Läuft immer, auch wenn der SSH-Step fehlschlägt
if: always()
uses: s3rj1k/matrix-action@v2
with:
template: |
### Authelia Update Bericht
**Status:** ${{ steps.ssh_step.outputs.status_msg || 'Build abgebrochen' }}
**Event:** `${{ github.event_name }}`
**Build:** [#${{ github.run_number }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})
**Details:**
Exit-Code: `${{ steps.ssh_step.outputs.exit_code }}`
server: 'https://matrix.familie-berner.de'
room_id: ${{ secrets.ROOMID_MATRIX }}
user_id: ${{ secrets.USERID_MATRIX }}
password: ${{ secrets.PASSWORD_MATRIX }}