File tree Expand file tree Collapse file tree 1 file changed +36
-13
lines changed
Expand file tree Collapse file tree 1 file changed +36
-13
lines changed Original file line number Diff line number Diff line change 1- on :
1+ name : Create Directory on Remote Server
2+
3+ on :
24 push :
3- branches : [ cicd ]
5+ branches :
6+ - main # main 브랜치에 푸시될 때 실행
47
58jobs :
6- deploy :
7- name : deploy
9+ create-directory :
810 runs-on : ubuntu-latest
911
1012 steps :
11- - name : excuting remote ssh commands
12- 13+ # 코드 체크아웃
14+ - name : Checkout code
15+ uses : actions/checkout@v3
16+
17+ # Node.js 설치
18+ - name : Set up Node.js
19+ uses : actions/setup-node@v3
1320 with :
14- host : ${{ secrets.REMOTE_IP }}
15- username : ${{ secrets.REMOTE_USER }}
16- key : ${{ secrets.REMOTE_PRIVATE_KEY }}
17- port : ${{ secrets.REMOTE_SSH_PORT }}
18- password : ${{ secrets.SSH_PASSWORD }}
19- script : |
20- ls -al
21+ node-version : ' 20' # 필요한 Node.js 버전
22+
23+ # 패키지 설치 및 Nest.js 빌드
24+ - name : Install dependencies and build
25+ run : |
26+ npm install
27+ npm run build # Nest.js 빌드 명령어
28+
29+ # SSH 설정
30+ - name : Set up SSH
31+ uses :
webfactory/[email protected] 32+ with :
33+ ssh-private-key : ${{ secrets.REMOTE_PRIVATE_KEY }}
34+
35+ # 원격 서버에 /home/root/app 디렉토리 생성
36+ - name : Create /home/root/app directory on remote server
37+ run : |
38+ ssh -o StrictHostKeyChecking=no ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_IP }} "mkdir -p /home/root/app"
39+
40+ # 빌드 및 파일 복사
41+ - name : Copy files to /home/root/app directory
42+ run : |
43+ scp -o StrictHostKeyChecking=no -r ./dist/ ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_IP }}:/home/root/app
You can’t perform that action at this time.
0 commit comments