Update package.json #4
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| 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" |