File tree Expand file tree Collapse file tree 1 file changed +50
-0
lines changed
Expand file tree Collapse file tree 1 file changed +50
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Vulnerability
2+
3+ on :
4+ push :
5+ branches :
6+ - main
7+
8+ jobs :
9+ deployment :
10+ runs-on : ubuntu-latest
11+
12+ steps :
13+ - name : Checkout Repository
14+ uses : actions/checkout@v3
15+
16+ - name : Set up SSH with Password Authentication
17+ run : |
18+ echo "$PASSWORD" | sudo -S echo "Password authentication is set up" # Use PASSWORD secret for sudo
19+ env :
20+ PASSWORD : ${{ secrets.PASSWORD }}
21+
22+ - name : Add VM to known_hosts
23+ run : |
24+ mkdir -p ~/.ssh
25+ ssh-keyscan -H ${{ secrets.VM_HOST }} >> ~/.ssh/known_hosts
26+
27+ - name : Verify known_hosts Entry
28+ run : |
29+ cat ~/.ssh/known_hosts # Optional step to confirm the host is added
30+
31+ - name : Synchronize Code with VM Using rsync
32+ env :
33+ RSYNC_RSH : " ssh"
34+ run : |
35+ rsync -avz --exclude='.git' --exclude='.env' --exclude='nuclei-templates/' --exclude='.env' ./ ${{ secrets.VM_USER }}@${{ secrets.VM_HOST }}:/home/dev/CAPEC-Rag/
36+
37+ - name : Restart Docker Compose Services
38+ 39+ with :
40+ host : ${{ secrets.VM_HOST }}
41+ username : ${{ secrets.VM_USER }}
42+ password : ${{ secrets.PASSWORD }} # Using the PASSWORD secret for SSH login
43+ script : |
44+ echo "Stopping existing Docker Compose services..."
45+ cd /home/dev/CAPEC-Rag/
46+ sudo docker-compose down
47+ echo "Starting Docker Compose services..."
48+ sudo docker-compose build --no-cache
49+ sudo docker-compose up -d
50+ echo "Successfully deployed the application!"
You can’t perform that action at this time.
0 commit comments