File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change 5656 uses : softprops/action-gh-release@v2
5757 with :
5858 files : csdmpro.tar.gz
59+
60+ deploy :
61+ name : Deploy csdmpro
62+ needs : build
63+ runs-on : ubuntu-latest
64+
65+ steps :
66+ - name : Checkout code
67+ uses : actions/checkout@v3
68+
69+ - name : Set up SSH key
70+ run : |
71+ mkdir -p ~/.ssh
72+ echo "${{ secrets.SSH_KEY }}" > ~/.ssh/id_ed25519
73+ chmod 600 ~/.ssh/id_ed25519
74+ ssh-keyscan cs.thekhanj.ir >> ~/.ssh/known_hosts
75+
76+ - name : Deploy using custom script
77+ env :
78+ API_TOKEN : ${{ secrets.API_TOKEN }}
79+ TAG : ${{ github.ref_name }}
80+ run : ./ci/deploy
Original file line number Diff line number Diff line change 1+ #! /usr/bin/env sh
2+
3+ if [ -z " $API_TOKEN " ]; then
4+ echo " API_TOKEN not provided"
5+ exit 1
6+ fi
7+
8+ scp ./csdmpro.tar.gz root@cs.thekhanj.ir:/tmp &&
9+ exit 1
10+
11+ ssh root@cs.thekhanj.ir " bash -s" << -EOF
12+ cd /tmp
13+ tar xzvf csdmpro.tar.gz || exit 1
14+ cp csdmpro /usr/bin
15+
16+ cat >/etc/systemd/system/csdmpro.service <<-FART
17+ [Unit]
18+ Description=CSDMPRO Telegram Bot Daemon
19+ After=network.target
20+ Wants=network.target
21+
22+ [Service]
23+ Type=simple
24+ Environment="API_TOKEN=$API_TOKEN "
25+ ExecStart=/usr/bin/csdmpro
26+ Restart=always
27+ RestartSec=2s
28+ User=root
29+ Group=root
30+
31+ [Install]
32+ WantedBy=multi-user.target
33+ FART
34+
35+
36+ systemctl daemon-reload &&
37+ systemctl enable csdmpro &&
38+ systemctl restart csdmpro
39+ EOF
40+
41+ if [ " $? " -ne 0 ]; then
42+ echo ' ssh: deployment failed'
43+ exit 1
44+ fi
You can’t perform that action at this time.
0 commit comments