-
Notifications
You must be signed in to change notification settings - Fork 0
41 lines (36 loc) · 1.23 KB
/
deploy.yml
File metadata and controls
41 lines (36 loc) · 1.23 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
name: Deploy Gateway App
on:
push:
branches:
- main # Change to your deployment branch if needed
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Checkout code
uses: actions/checkout@v3
- name: Setup SSH Key
run: |
mkdir -p ~/.ssh
echo "${{ secrets.SSH_PRIVATE_KEY }}" > ~/.ssh/id_rsa
chmod 600 ~/.ssh/id_rsa
cat >> ~/.ssh/config <<EOL
Host telebit-server
HostName ${{ secrets.REMOTE_HOST }}
User ${{ secrets.REMOTE_USER }}
ProxyCommand openssl s_client -connect %h:443 -servername %h -quiet
IdentityFile ~/.ssh/id_rsa
StrictHostKeyChecking no
EOL
- name: Deploy via SSH
run: |
ssh telebit-server << 'EOF'
cd Gateway_API/ # Change to your app directory
git pull origin main # Pull latest changes
npm install # Install dependencies
npm run build # (Optional) Build the app
pm2 stop gateway-app || true # Stop app if running
pm2 start npm --name "gateway-app" -- run dev # Start app
pm2 save # Save PM2 process
pm2 list # Show running apps
EOF