File tree Expand file tree Collapse file tree 1 file changed +33
-0
lines changed
Expand file tree Collapse file tree 1 file changed +33
-0
lines changed Original file line number Diff line number Diff line change 1+ name : Build and Deploy Docker Services
2+
3+ on :
4+ push :
5+ branches : [ "main" ]
6+
7+ jobs :
8+ deploy :
9+ runs-on : ubuntu-latest
10+
11+ steps :
12+ - name : Set up SSH
13+ uses : webfactory/ssh-agent@v0.9.0
14+ with :
15+ ssh-private-key : ${{ secrets.SSH_PRIVATE_KEY }}
16+
17+ - name : Add remote server to known_hosts
18+ run : |
19+ ssh-keyscan ${{ secrets.SERVER_HOST }} >> ~/.ssh/known_hosts
20+
21+ - name : Deploy to server
22+ run : |
23+ ssh ${{ secrets.SERVER_USER }}@${{ secrets.SERVER_HOST }} << 'ENDSSH'
24+ # Navigate to project directory
25+ cd ${{ secrets.PROJECT_DIR }}
26+
27+ # Pull latest code
28+ git pull
29+
30+ # Build and restart services using docker-compose
31+ docker compose build
32+ docker compose up -d
33+ ENDSSH
You can’t perform that action at this time.
0 commit comments