-
Notifications
You must be signed in to change notification settings - Fork 0
86 lines (72 loc) · 2.19 KB
/
ci-cd.yml
File metadata and controls
86 lines (72 loc) · 2.19 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
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
name: CommUnity CI/CD Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Set Up Node.js
uses: actions/setup-node@v3
with:
node-version: 18
- name: Install Server Dependencies
run: |
cd server
npm install
- name: Install Client Dependencies
run: |
cd client
npm install
- name: Run Server Tests
run: |
cd server
npm test
- name: Run Client Tests
run: |
cd client
npm test
deploy:
needs: build
runs-on: ubuntu-latest
steps:
- name: Checkout Code
uses: actions/checkout@v3
- name: Deploy Application
run: |
echo "Deploying CommUnity application..."
# Add actual deployment commands here (e.g., Firebase, Vercel, or DigitalOcean)
notify:
needs: deploy
runs-on: ubuntu-latest
steps:
- name: Send Slack Notification
env:
SLACK_WEBHOOK_URL: ${{ secrets.SLACK_WEBHOOK_URL }}
run: |
curl -X POST -H 'Content-type: application/json' --data '{
"text": "🚀 CommUnity CI/CD Pipeline Completed for ${{ github.repository }} on branch ${{ github.ref_name }}"
}' $SLACK_WEBHOOK_URL
- name: Send Email Notification
uses: dawidd6/action-send-mail@v3
with:
server_address: ${{ secrets.EMAIL_HOST }}
server_port: ${{ secrets.EMAIL_PORT }}
username: ${{ secrets.EMAIL_USERNAME }}
password: ${{ secrets.SMTP_PASSWORD }}
subject: "CommUnity CI/CD Pipeline Completed"
to: ${{ secrets.EMAIL_TO }}
from: "GitHub Actions"
body: |
📝 **Commit Details**
- **Author:** ${{ github.actor }}
- **Branch:** ${{ github.ref_name }}
- **Commit Message:** ${{ github.event.head_commit.message }}
- **Commit URL:** ${{ github.event.head_commit.url }}
✅ The latest changes have been pushed to the repository.