-
Notifications
You must be signed in to change notification settings - Fork 0
49 lines (40 loc) · 1.4 KB
/
deploy-ec2.yml
File metadata and controls
49 lines (40 loc) · 1.4 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: Deploy TipsChain Node to EC2
on:
push:
branches: [ "main" ]
workflow_dispatch: # Manual tetikleme için
env:
AWS_REGION: us-east-1
EC2_INSTANCE_ID: i-xxxxxxxxxxxxxxxxx # EC2 Instance ID'niz
SSH_USER: ubuntu
PROJECT_PATH: /home/ubuntu/tips-ecosystem
jobs:
deploy:
runs-on: ubuntu-latest
environment: production
steps:
- name: Checkout code
uses: actions/checkout@v4
- name: Configure AWS Credentials
uses: aws-actions/configure-aws-credentials@v4
with:
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
aws-region: ${{ env.AWS_REGION }}
- name: Deploy to EC2 via SSH
uses: appleboy/ssh-action@v1.0.3
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ env.SSH_USER }}
key: ${{ secrets.EC2_SSH_KEY }}
script: |
cd ${{ env.PROJECT_PATH }}
git pull origin main
npm ci --production
npm run compile
# Node'u restart et (systemd kullanıyorsanız)
sudo systemctl restart tips-node
# Health check
sleep 10
curl -f http://localhost:8545 -X POST -H "Content-Type: application/json" -d '{"jsonrpc":"2.0","method":"eth_blockNumber","params":[],"id":1}' || exit 1
echo "✅ Deployment completed successfully"