File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -2,21 +2,30 @@ name: Deploy to EC2
22
33on :
44 push :
5- branches : [ main ]
5+ branches :
6+ - main
67
78jobs :
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
You can’t perform that action at this time.
0 commit comments