Skip to content

Commit 9a5cce4

Browse files
authored
Create deploy.yml
1 parent 7edb662 commit 9a5cce4

File tree

1 file changed

+30
-0
lines changed

1 file changed

+30
-0
lines changed

.github/workflows/deploy.yml

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
name: Deploy to EC2
2+
3+
on:
4+
push:
5+
branches:
6+
- vercel_build
7+
8+
jobs:
9+
deploy:
10+
runs-on: ubuntu-latest
11+
12+
steps:
13+
- name: Checkout code
14+
uses: actions/checkout@v2
15+
16+
- name: Set up SSH
17+
run: |
18+
echo "$SSH_PRIVATE_KEY" > private_key.pem
19+
chmod 600 private_key.pem
20+
21+
- name: Pull changes and restart Nginx
22+
env:
23+
SSH_PRIVATE_KEY: ${{ secrets.SSH_PRIVATE_KEY }}
24+
EC2_HOST: 54.242.186.202
25+
run: |
26+
ssh -o StrictHostKeyChecking=no -i private_key.pem ec2-user@$EC2_HOST << 'EOF'
27+
cd /var/www/bfr
28+
git pull origin vercel-build
29+
sudo systemctl restart nginx
30+
EOF

0 commit comments

Comments
 (0)