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 2121 run : docker build -t coder80/usmile:latest .
2222 - name : Push to Docker Hub
2323 run : docker push coder80/usmile:latest
24+
25+ deploy :
26+ needs : build
27+ runs-on : ubuntu-latest
28+ steps :
29+ - name : Create SSH key
30+ run : |
31+ mkdir -p ~/.ssh
32+ echo "$SSH_PRIVATE_KEY" > ~/.ssh/key
33+ sudo chmod 600 ~/.ssh/key
34+ ssh-keyscan -H $SSH_HOST > ~/.ssh/known_hosts
35+ env :
36+ SSH_PRIVATE_KEY : ${{secrets.SSH_PRIVATE_KEY}}
37+ SSH_HOST : ${{secrets.SSH_HOST}}
38+
39+ - name : Check out repository code
40+ uses : actions/checkout@v4
41+
42+ - name : Upload compose file
43+ run : |
44+ rsync -e "ssh -i ~/.ssh/key" compose.yml root@$SSH_HOST:/root/projects/usmile/compose.yml
45+ env :
46+ SSH_HOST : ${{secrets.SSH_HOST}}
47+
48+ - name : Connnect and deploy
49+ run : |
50+ ssh -i ~/.ssh/key root@$SSH_HOST "
51+ cd /root/projects/usmile &&
52+ docker compose --profile prod pull
53+ docker compose --profile prod up -d &&
54+ docker system prune -f"
55+ env :
56+ SSH_HOST : ${{secrets.SSH_HOST}}
You can’t perform that action at this time.
0 commit comments