Skip to content

Commit b209043

Browse files
authored
chore: Update main.yml
1 parent d4c08eb commit b209043

File tree

1 file changed

+11
-17
lines changed

1 file changed

+11
-17
lines changed

.github/workflows/main.yml

Lines changed: 11 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@ name: Create Directory on Remote Server
33
on:
44
push:
55
branches:
6-
- cicd # main 브랜치에 푸시될 때 실행
6+
- cicd
77

88
jobs:
99
create-directory:
@@ -18,27 +18,21 @@ jobs:
1818
- name: Set up Node.js
1919
uses: actions/setup-node@v3
2020
with:
21-
node-version: '20' # 필요한 Node.js 버전
21+
node-version: '23'
2222

2323
# 패키지 설치 및 Nest.js 빌드
2424
- name: Install dependencies and build
2525
run: |
2626
cd backend
2727
npm install
28-
npm run build # Nest.js 빌드 명령어
28+
npm run build
2929
30-
# SSH 설정
31-
- name: Set up SSH
32-
uses: webfactory/ssh-agent@v0.5.3
30+
# 배포용 쉘 스크립트 파일 전송
31+
- name: Copy deploy.sh to remote server
32+
uses: appleboy/scp-action@v0.1.1
3333
with:
34-
ssh-private-key: ${{ secrets.REMOTE_PRIVATE_KEY }}
35-
36-
# 원격 서버에 /home/root/app 디렉토리 생성
37-
- name: Create /home/root/app directory on remote server
38-
run: |
39-
ssh -o StrictHostKeyChecking=no ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_IP }} "mkdir -p /home/root/app"
40-
41-
# 빌드 및 파일 복사
42-
- name: Copy files to /home/root/app directory
43-
run: |
44-
scp -o StrictHostKeyChecking=no -r ./backend/dist/ ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_IP }}:/home/root/app
34+
host: ${{ secrets.REMOTE_HOST }}
35+
username: ${{ secrets.REMOTE_USER }}
36+
key: ${{ secrets.SSH_PRIVATE_KEY }}
37+
source: ./deploy.sh
38+
target: /home/root/deploy.sh

0 commit comments

Comments
 (0)