diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 8a70fe8..819c239 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -227,17 +227,123 @@ jobs: echo "## 🚀 Deployment Summary" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "### Backend Image" >> $GITHUB_STEP_SUMMARY - echo "- Registry: \`${{ env.REGISTRY }}/backend\`" >> $GITHUB_STEP_SUMMARY + echo "- Registry: \`${{ env.REGISTRY }}/xpeditis-backend\`" >> $GITHUB_STEP_SUMMARY echo "- Branch: \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY echo "- Commit: \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "### Frontend Image" >> $GITHUB_STEP_SUMMARY - echo "- Registry: \`${{ env.REGISTRY }}/frontend\`" >> $GITHUB_STEP_SUMMARY + echo "- Registry: \`${{ env.REGISTRY }}/xpeditis-frontend\`" >> $GITHUB_STEP_SUMMARY echo "- Branch: \`${{ github.ref_name }}\`" >> $GITHUB_STEP_SUMMARY echo "- Commit: \`${{ github.sha }}\`" >> $GITHUB_STEP_SUMMARY echo "" >> $GITHUB_STEP_SUMMARY echo "### Pull Commands" >> $GITHUB_STEP_SUMMARY echo "\`\`\`bash" >> $GITHUB_STEP_SUMMARY - echo "docker pull ${{ env.REGISTRY }}/backend:${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY - echo "docker pull ${{ env.REGISTRY }}/frontend:${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY + echo "docker pull ${{ env.REGISTRY }}/xpeditis-backend:${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY + echo "docker pull ${{ env.REGISTRY }}/xpeditis-frontend:${{ github.ref_name }}" >> $GITHUB_STEP_SUMMARY echo "\`\`\`" >> $GITHUB_STEP_SUMMARY + + # ============================================ + # Discord Notification - Success + # ============================================ + notify-success: + name: Discord Notification (Success) + runs-on: ubuntu-latest + needs: [backend, frontend] + if: success() + + steps: + - name: Send Discord notification + run: | + curl -H "Content-Type: application/json" \ + -d '{ + "embeds": [{ + "title": "✅ CI/CD Pipeline Success", + "description": "Deployment completed successfully!", + "color": 3066993, + "fields": [ + { + "name": "Repository", + "value": "${{ github.repository }}", + "inline": true + }, + { + "name": "Branch", + "value": "${{ github.ref_name }}", + "inline": true + }, + { + "name": "Commit", + "value": "[${{ github.sha }}](${{ github.event.head_commit.url }})", + "inline": false + }, + { + "name": "Backend Image", + "value": "`${{ env.REGISTRY }}/xpeditis-backend:${{ github.ref_name }}`", + "inline": false + }, + { + "name": "Frontend Image", + "value": "`${{ env.REGISTRY }}/xpeditis-frontend:${{ github.ref_name }}`", + "inline": false + }, + { + "name": "Workflow", + "value": "[${{ github.workflow }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})", + "inline": false + } + ], + "timestamp": "${{ github.event.head_commit.timestamp }}", + "footer": { + "text": "Xpeditis CI/CD" + } + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK_URL }} + + # ============================================ + # Discord Notification - Failure + # ============================================ + notify-failure: + name: Discord Notification (Failure) + runs-on: ubuntu-latest + needs: [backend, frontend] + if: failure() + + steps: + - name: Send Discord notification + run: | + curl -H "Content-Type: application/json" \ + -d '{ + "embeds": [{ + "title": "❌ CI/CD Pipeline Failed", + "description": "Deployment failed! Check the logs for details.", + "color": 15158332, + "fields": [ + { + "name": "Repository", + "value": "${{ github.repository }}", + "inline": true + }, + { + "name": "Branch", + "value": "${{ github.ref_name }}", + "inline": true + }, + { + "name": "Commit", + "value": "[${{ github.sha }}](${{ github.event.head_commit.url }})", + "inline": false + }, + { + "name": "Workflow", + "value": "[${{ github.workflow }}](${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }})", + "inline": false + } + ], + "timestamp": "${{ github.event.head_commit.timestamp }}", + "footer": { + "text": "Xpeditis CI/CD" + } + }] + }' \ + ${{ secrets.DISCORD_WEBHOOK_URL }}