@@ -115,58 +115,86 @@ jobs:
115115 retention-days : 30
116116
117117 - name : Send email notification on success
118- if : success()
119- uses : dawidd6/action-send-mail@v3
120- with :
121- server_address : ${{ secrets.MAIL_SERVER }}
122- server_port : ${{ secrets.MAIL_PORT }}
123- secure : true
124- username : ${{ secrets.MAIL_USERNAME }}
125- password : ${{ secrets.MAIL_PASSWORD }}
126- subject : ✅ Successful Build and Deploy for ${{ github.repository }}
127- html_body : |
128- Build and deployment for ${{ github.repository }} completed successfully.
129-
130- <b>Details:</b>
131- <ul>
132- <li>Repository: ${{ github.repository }}</li>
133- <li>Commit: ${{ github.sha }}</li>
134- <li>Commit message: ${{ github.event.head_commit.message }}</li>
135- <li>Workflow: ${{ github.workflow }}</li>
136- <li>Timestamp: $(date)</li>
137- </ul>
138-
139- <p>
140- <a href="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/">View the deployment</a><br>
141- <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">View workflow run</a>
142- </p>
143- from : GitHub Actions <${{ secrets.MAIL_USERNAME }}>
144- to : ${{ secrets.MAIL_RECIPIENT }}
145-
146- - name : Send email notification on failure
147- if : failure()
148- uses : dawidd6/action-send-mail@v3
149- with :
150- server_address : ${{ secrets.MAIL_SERVER }}
151- server_port : ${{ secrets.MAIL_PORT }}
152- secure : true
153- username : ${{ secrets.MAIL_USERNAME }}
154- password : ${{ secrets.MAIL_PASSWORD }}
155- subject : ❌ Failed Build for ${{ github.repository }}
156- html_body : |
157- Build or deployment for ${{ github.repository }} failed.
158-
159- <b>Details:</b>
160- <ul>
161- <li>Repository: ${{ github.repository }}</li>
162- <li>Commit: ${{ github.sha }}</li>
163- <li>Commit message: ${{ github.event.head_commit.message }}</li>
164- <li>Workflow: ${{ github.workflow }}</li>
165- <li>Timestamp: $(date)</li>
166- </ul>
167-
168- <p>
169- <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">View logs and details</a>
170- </p>
171- from : GitHub Actions <${{ secrets.MAIL_USERNAME }}>
172- to : ${{ secrets.MAIL_RECIPIENT }}
118+ if : success()
119+ uses : dawidd6/action-send-mail@v3
120+ with :
121+ server_address : ${{ secrets.MAIL_SERVER }}
122+ server_port : ${{ secrets.MAIL_PORT }}
123+ secure : true
124+ username : ${{ secrets.MAIL_USERNAME }}
125+ password : ${{ secrets.MAIL_PASSWORD }}
126+ subject : ✅ Successful Build and Deploy for ${{ github.repository }}
127+ html_body : |
128+ <h2>🚀 Build and deployment for ${{ github.repository }} completed successfully!</h2>
129+
130+ <b>📋 Details:</b>
131+ <ul>
132+ <li><b>Repository:</b> ${{ github.repository }}</li>
133+ <li><b>Branch:</b> ${{ github.ref_name }}</li>
134+ <li><b>Commit:</b> ${{ github.sha }}</li>
135+ <li><b>Commit message:</b> ${{ github.event.head_commit.message }}</li>
136+ <li><b>Workflow:</b> ${{ github.workflow }}</li>
137+ <li><b>Timestamp:</b> ${{ format(github.event.repository.updated_at, 'dddd, MMMM Do YYYY, h:mm:ss a') }}</li>
138+ <li><b>Author:</b> ${{ github.actor }}</li>
139+ <li><b>Run ID:</b> ${{ github.run_id }}</li>
140+ <li><b>Run Number:</b> ${{ github.run_number }}</li>
141+ </ul>
142+
143+ <h3>📊 Deployment Information</h3>
144+ <ul>
145+ <li><b>Environment:</b> GitHub Pages</li>
146+ <li><b>Status:</b> ${{ env.deployment_status || 'Completed' }}</li>
147+ <li><b>Deployed URL:</b> <a href="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/">https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/</a></li>
148+ </ul>
149+
150+ <h3>🔗 Quick Links</h3>
151+ <p>
152+ <a href="https://${{ github.repository_owner }}.github.io/${{ github.event.repository.name }}/">📱 View the deployment</a><br>
153+ <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">📋 View workflow run</a><br>
154+ <a href="${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}">💻 View commit details</a>
155+ </p>
156+
157+ <hr>
158+ <p style="color:#666;font-size:12px">This is an automated message from GitHub Actions. Please do not reply to this email.</p>
159+ from : GitHub Actions <${{ secrets.MAIL_USERNAME }}>
160+ to : ${{ secrets.MAIL_RECIPIENT }}
161+
162+ name : Send email notification on failure
163+ if : failure()
164+ uses : dawidd6/action-send-mail@v3
165+ with :
166+ server_address : ${{ secrets.MAIL_SERVER }}
167+ server_port : 587
168+ secure : false
169+ username : ${{ secrets.MAIL_USERNAME }}
170+ password : ${{ secrets.MAIL_PASSWORD }}
171+ subject : ❌ Failed Build for ${{ github.repository }}
172+ html_body : |
173+ <h2>⚠️ Build or deployment for ${{ github.repository }} failed!</h2>
174+
175+ <b>📋 Details:</b>
176+ <ul>
177+ <li><b>Repository:</b> ${{ github.repository }}</li>
178+ <li><b>Branch:</b> ${{ github.ref_name }}</li>
179+ <li><b>Commit:</b> ${{ github.sha }}</li>
180+ <li><b>Commit message:</b> ${{ github.event.head_commit.message }}</li>
181+ <li><b>Workflow:</b> ${{ github.workflow }}</li>
182+ <li><b>Timestamp:</b> ${{ format(github.event.repository.updated_at, 'dddd, MMMM Do YYYY, h:mm:ss a') }}</li>
183+ <li><b>Author:</b> ${{ github.actor }}</li>
184+ <li><b>Run ID:</b> ${{ github.run_id }}</li>
185+ <li><b>Run Number:</b> ${{ github.run_number }}</li>
186+ </ul>
187+
188+ <h3>❌ Error Information</h3>
189+ <p>Review the workflow logs for detailed error information.</p>
190+
191+ <h3>🔗 Quick Links</h3>
192+ <p>
193+ <a href="${{ github.server_url }}/${{ github.repository }}/actions/runs/${{ github.run_id }}">📋 View error logs and details</a><br>
194+ <a href="${{ github.server_url }}/${{ github.repository }}/commit/${{ github.sha }}">💻 View commit details</a>
195+ </p>
196+
197+ <hr>
198+ <p style="color:#666;font-size:12px">This is an automated message from GitHub Actions. Please do not reply to this email.</p>
199+ from : GitHub Actions <${{ secrets.MAIL_USERNAME }}>
200+ to : ${{ secrets.MAIL_RECIPIENT }}
0 commit comments