-
Notifications
You must be signed in to change notification settings - Fork 0
60 lines (54 loc) · 3.07 KB
/
Copy pathdeployment-status.yml
File metadata and controls
60 lines (54 loc) · 3.07 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
name: Deployment Status
on:
deployment_status:
workflow_run:
workflows: ["Release"]
types: [completed]
jobs:
deployment-notification:
runs-on: ubuntu-latest
if: github.event.deployment_status.state == 'success' || github.event.workflow_run.conclusion == 'success'
steps:
- name: Get deployment info
id: deployment
run: |
if [ "${{ github.event_name }}" = "deployment_status" ]; then
echo "url=${{ github.event.deployment_status.target_url }}" >> $GITHUB_OUTPUT
echo "environment=${{ github.event.deployment_status.environment }}" >> $GITHUB_OUTPUT
echo "state=${{ github.event.deployment_status.state }}" >> $GITHUB_OUTPUT
else
repo_name="${{ github.repository##*/ }}"; echo "url=https://${{ github.repository_owner }}.github.io/${repo_name}" >> $GITHUB_OUTPUT
echo "environment=github-pages" >> $GITHUB_OUTPUT
echo "state=success" >> $GITHUB_OUTPUT
fi
- name: Create deployment summary
run: |
echo "## 🚀 Deployment Successful" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Details" >> $GITHUB_STEP_SUMMARY
echo "- **Environment**: ${{ steps.deployment.outputs.environment }}" >> $GITHUB_STEP_SUMMARY
echo "- **Status**: ${{ steps.deployment.outputs.state }}" >> $GITHUB_STEP_SUMMARY
echo "- **URL**: [${{ steps.deployment.outputs.url }}](${{ steps.deployment.outputs.url }})" >> $GITHUB_STEP_SUMMARY
echo "- **Time**: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🎉 Your application is now live!" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "Visit your deployed application: **[${{ steps.deployment.outputs.url }}](${{ steps.deployment.outputs.url }})**" >> $GITHUB_STEP_SUMMARY
deployment-failure:
runs-on: ubuntu-latest
if: github.event.deployment_status.state == 'failure' || github.event.workflow_run.conclusion == 'failure'
steps:
- name: Create failure summary
run: |
echo "## ❌ Deployment Failed" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### Details" >> $GITHUB_STEP_SUMMARY
echo "- **Environment**: ${{ github.event.deployment_status.environment || 'github-pages' }}" >> $GITHUB_STEP_SUMMARY
echo "- **Status**: ${{ github.event.deployment_status.state || github.event.workflow_run.conclusion }}" >> $GITHUB_STEP_SUMMARY
echo "- **Time**: $(date -u '+%Y-%m-%d %H:%M:%S UTC')" >> $GITHUB_STEP_SUMMARY
echo "" >> $GITHUB_STEP_SUMMARY
echo "### 🔧 Troubleshooting" >> $GITHUB_STEP_SUMMARY
echo "1. Check the workflow logs for detailed error messages" >> $GITHUB_STEP_SUMMARY
echo "2. Verify that all required secrets and permissions are configured" >> $GITHUB_STEP_SUMMARY
echo "3. Ensure the build artifacts are properly generated" >> $GITHUB_STEP_SUMMARY
echo "4. Check GitHub Pages settings in repository settings" >> $GITHUB_STEP_SUMMARY