Skip to content

Commit

Permalink
feat: set up initial CD pipeline
Browse files Browse the repository at this point in the history
  • Loading branch information
tufstraka authored Feb 4, 2025
1 parent 2919327 commit aca6fde
Showing 1 changed file with 30 additions and 0 deletions.
30 changes: 30 additions & 0 deletions .github/workflows/ec2-deploy.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,30 @@
name: Deploy to EC2

on:
push:
branches:
- main

jobs:
deploy:
runs-on: ubuntu-latest

steps:
- name: Checkout code
uses: actions/checkout@v2

- name: Set up SSH
run: |
echo "$SSH_PRIVATE_KEY" > private_key.pem
chmod 600 private_key.pem
- name: Pull changes and restart Nginx
env:
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
EC2_HOST: 54.242.186.202
run: |
ssh -o StrictHostKeyChecking=no -i private_key.pem ubuntu@$EC2_HOST << 'EOF'
cd /var/www/lottery
git pull origin main
sudo systemctl restart nginx
EOF

0 comments on commit aca6fde

Please sign in to comment.