Skip to content

Commit 135e180

Browse files
authored
Update deploy.yml
1 parent 630c6f2 commit 135e180

1 file changed

Lines changed: 21 additions & 12 deletions

File tree

.github/workflows/deploy.yml

Lines changed: 21 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -2,21 +2,30 @@ name: Deploy to EC2
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches:
6+
- main
67

78
jobs:
89
deploy:
910
runs-on: ubuntu-latest
1011

1112
steps:
12-
- name: Deploy via SSH
13-
uses: appleboy/ssh-action@v1.0.0
14-
with:
15-
host: ${{ secrets.EC2_HOST }}
16-
username: ${{ secrets.EC2_USERNAME }}
17-
key: ${{ secrets.EC2_SSH_KEY }}
18-
script: |
19-
cd /home/ubuntu/skribble-app
20-
git pull origin main
21-
docker-compose down
22-
docker-compose up -d --build
13+
- name: Checkout code
14+
uses: actions/checkout@v3
15+
16+
- name: Create SSH key from secret
17+
run: |
18+
echo "${{ secrets.EC2_SSH_KEY }}" | base64 -d > ec2_key.pem
19+
chmod 400 ec2_key.pem
20+
21+
- name: Deploy to EC2 via SSH
22+
uses: appleboy/ssh-action@v1.0.0
23+
with:
24+
host: ${{ secrets.EC2_HOST }}
25+
username: ${{ secrets.EC2_USERNAME }}
26+
key_path: ec2_key.pem
27+
script: |
28+
cd /home/ubuntu/skribble-app
29+
git pull origin main
30+
docker-compose down
31+
docker-compose up -d --build

0 commit comments

Comments
 (0)