We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 8fbef9e commit f99ec20Copy full SHA for f99ec20
.github/workflows/build-and-deploy.yml
.github/workflows/deploy.yml
@@ -0,0 +1,26 @@
1
+name: Deploy to EC2
2
+
3
+on:
4
+ push:
5
+ branches:
6
+ - main # main 브랜치 push 시 자동 배포
7
8
+jobs:
9
+ deploy:
10
+ name: Deploy to EC2 Server
11
+ runs-on: ubuntu-latest
12
13
+ steps:
14
+ - name: Checkout code
15
+ uses: actions/checkout@v4
16
17
+ - name: Set up SSH key
18
+ run: |
19
+ mkdir -p ~/.ssh
20
+ echo "${{ secrets.EC2_KEY }}" > ~/.ssh/id_rsa
21
+ chmod 600 ~/.ssh/id_rsa
22
+ ssh-keyscan -H ${{ secrets.EC2_HOST }} >> ~/.ssh/known_hosts
23
24
+ - name: SSH and deploy
25
26
+ ssh ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "cd ~ && ./deploy.sh"
0 commit comments