-
Notifications
You must be signed in to change notification settings - Fork 1
45 lines (34 loc) · 1019 Bytes
/
deploy.yml
File metadata and controls
45 lines (34 loc) · 1019 Bytes
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
name: Deploy to EC2
on:
push:
branches:
- master
workflow_dispatch: # Allow manual trigger
jobs:
deploy:
runs-on: ubuntu-latest
steps:
- name: Deploy to EC2
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.EC2_HOST }}
username: ec2-user
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd /home/ec2-user/bot_man
# Pull latest code
git fetch origin master
git reset --hard origin/master
# Install dependencies
npm ci --production
# Generate Prisma client
npx prisma generate
# Run migrations (if any)
npx prisma migrate deploy
# Deploy Discord slash commands
npm run deploy-commands
# Restart PM2 processes
pm2 restart ecosystem.config.cjs --update-env
# Save PM2 process list
pm2 save
echo "✅ Deployment complete!"