-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (47 loc) · 1.72 KB
/
Copy pathdeploy_to_server.yml
File metadata and controls
49 lines (47 loc) · 1.72 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
name: Docker pull to server
on:
workflow_call:
secrets:
host:
description: "Host for SSH"
username:
description: "Username for SSH"
password:
description: "Password for SSH"
port:
description: "Port for SSH"
server_name:
description: "Server name"
tg_token:
description: "TG token"
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: executing remote ssh commands using password
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.host }}
username: ${{ secrets.username }}
password: ${{ secrets.password }}
port: ${{ secrets.port }}
command_timeout: 10m
script: |
cd /root/monopoly
docker compose pull frontend
docker compose up -d --no-deps frontend
sleep 5
docker ps --filter "name=frontend" --format "{{.Status}}" | grep -q "Up" || (echo "Container is not running" && exit 1)
docker image prune -af
- name: Success to telegram
if: success()
run: |
msg_text='✅ Igropolius frontend upload success on server: ${{ secrets.server_name }}!'
curl -s -X POST 'https://api.telegram.org/bot${{ secrets.TG_TOKEN }}/sendMessage' \
-d "message_thread_id=4632&chat_id=-1002576065779_4632&text=${msg_text}&"
- name: Failure to telegram
if: failure()
run: |
msg_text='⚠️ Igropolius frontend upload failure on server: ${{ secrets.server_name }}!'
curl -s -X POST 'https://api.telegram.org/bot${{ secrets.TG_TOKEN }}/sendMessage' \
-d "message_thread_id=4632&chat_id=-1002576065779_4632&text=${msg_text}&"