1010 static-analysis :
1111 name : PHP Quality Checks
1212 runs-on : ubuntu-latest
13- strategy :
14- matrix :
15- webhook :
16- - ${{ secrets.WEBHOOK_DISCORD_URL }}
17- - ${{ secrets.WEBHOOK_FLUXER_URL }}
1813 steps :
1914 - uses : actions/checkout@v6.0.2
2015
@@ -30,25 +25,12 @@ jobs:
3025 - name : Run PHP Codesniffer
3126 run : composer run-script phpcs
3227
33- - name : Notify Failure
34- if : failure()
35- uses : rjstone/discord-webhook-notify@v1.0.4
36- with :
37- severity : error
38- details : Static Analysis (Lint/Stan/CS) failed.
39- webhookUrl : ${{ matrix.webhook }}
40-
4128 # 2. Job: Tests (Unit & Functional)
4229 # Dieser Job benötigt die MariaDB Service-Container
4330 tests :
4431 name : PHP Tests
4532 needs : static-analysis
4633 runs-on : ubuntu-latest
47- strategy :
48- matrix :
49- webhook :
50- - ${{ secrets.WEBHOOK_DISCORD_URL }}
51- - ${{ secrets.WEBHOOK_FLUXER_URL }}
5234 services :
5335 database-testing :
5436 image : mariadb:latest
@@ -80,24 +62,11 @@ jobs:
8062 APP_ENV : action
8163 DB_HOST : 127.0.0.1
8264
83- - name : Notify Failure
84- if : failure()
85- uses : rjstone/discord-webhook-notify@v1.0.4
86- with :
87- severity : error
88- details : Integration Tests failed.
89- webhookUrl : ${{ matrix.webhook }}
90-
9165 # 3. Deployment
9266 deploy :
9367 name : Deployment on Development
9468 needs : tests
9569 runs-on : ubuntu-latest
96- strategy :
97- matrix :
98- webhook :
99- - ${{ secrets.WEBHOOK_DISCORD_URL }}
100- - ${{ secrets.WEBHOOK_FLUXER_URL }}
10170 steps :
10271 - uses : actions/checkout@v6.0.2
10372
@@ -129,14 +98,49 @@ jobs:
12998 passphrase : ${{ secrets.DEPLOY_KEY_PASS }}
13099 script : rm -rf ${{ secrets.DEPLOY_PATH_API_DEV }}/data/cache/*
131100
132- - name : Deployment Notification
133- if : always()
101+ final-notification :
102+ name : Final Notification
103+ needs : [ static-analysis, tests, deploy ]
104+ if : always() # Dieser Job läuft IMMER, egal ob die vorherigen fehlschlagen
105+ runs-on : ubuntu-latest
106+ strategy :
107+ matrix :
108+ # HIER definieren wir die Matrix mit einfachen Schlüsseln
109+ target : [ discord, fluxer ]
110+ steps :
111+ - name : Check Workflow Status
112+ id : status_check
113+ run : |
114+ # Prüfe das Ergebnis aller vorherigen Jobs
115+ # needs ist ein JSON-Kontext, den wir parsen können
116+ if [[ "${{ needs.static-analysis.result }}" == "failure" || \
117+ "${{ needs.tests.result }}" == "failure" || \
118+ "${{ needs.deploy.result }}" == "failure" ]]; then
119+ echo "status=failure" >> $GITHUB_OUTPUT
120+ echo "message=❌ Ein Schritt im Workflow ist fehlgeschlagen." >> $GITHUB_OUTPUT
121+ else
122+ echo "status=success" >> $GITHUB_OUTPUT
123+ echo "message=🚀 Deployment auf Development erfolgreich!" >> $GITHUB_OUTPUT
124+ fi
125+
126+ # Schritt für Discord-Benachrichtigungen
127+ - name : Send Discord Notification
128+ if : matrix.target == 'discord'
129+ uses : rjstone/discord-webhook-notify@v1.0.4
130+ with :
131+ severity : ${{ steps.status_check.outputs.status == 'success' && 'info' || 'error' }}
132+ details : |
133+ ${{ steps.status_check.outputs.message }}
134+ [Logs ansehen](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
135+ webhookUrl : ${{ secrets.WEBHOOK_DISCORD_URL }}
136+
137+ # Schritt für Fluxer.app-Benachrichtigungen (mit curl, da Fluxer ein anderes Format erwartet!)
138+ - name : Send Discord Notification
139+ if : matrix.target == 'discord'
134140 uses : rjstone/discord-webhook-notify@v1.0.4
135141 with :
136- severity : ${{ job.status == 'success' && 'info' || 'error' }}
137- details : >-
138- ${{ job.status == 'success'
139- && '[🚀 Successful deployment to dev!](https://dev.ownhackathon.de/api/docs)'
140- || format('[❌ Deployment failed! View Logs](https://github.com/{0}/actions/runs/{1})', github.repository, github.run_id)
141- }}
142- webhookUrl : ${{ matrix.webhook }}
142+ severity : ${{ steps.status_check.outputs.status == 'success' && 'info' || 'error' }}
143+ details : |
144+ ${{ steps.status_check.outputs.message }}
145+ [Logs ansehen](https://github.com/${{ github.repository }}/actions/runs/${{ github.run_id }})
146+ webhookUrl : ${{ secrets.WEBHOOK_FLUXER_URL }}
0 commit comments