Skip to content

Commit f99ec20

Browse files
authored
Update and rename build-and-deploy.yml to deploy.yml
1 parent 8fbef9e commit f99ec20

File tree

2 files changed

+26
-57
lines changed

2 files changed

+26
-57
lines changed

.github/workflows/build-and-deploy.yml

Lines changed: 0 additions & 57 deletions
This file was deleted.

.github/workflows/deploy.yml

Lines changed: 26 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -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+
run: |
26+
ssh ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "cd ~ && ./deploy.sh"

0 commit comments

Comments
 (0)