chore: Update main.yml #5
Workflow file for this run
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
name: Create Directory on Remote Server | |
on: | |
push: | |
branches: | |
- cicd # main 브랜치에 푸시될 때 실행 | |
jobs: | |
create-directory: | |
runs-on: ubuntu-latest | |
steps: | |
# 코드 체크아웃 | |
- name: Checkout code | |
uses: actions/checkout@v3 | |
# Node.js 설치 | |
- name: Set up Node.js | |
uses: actions/setup-node@v3 | |
with: | |
node-version: '20' # 필요한 Node.js 버전 | |
# 패키지 설치 및 Nest.js 빌드 | |
- name: Install dependencies and build | |
run: | | |
cd backend | |
npm install | |
npm run build # Nest.js 빌드 명령어 | |
# SSH 설정 | |
- name: Set up SSH | |
uses: webfactory/[email protected] | |
with: | |
ssh-private-key: ${{ secrets.REMOTE_PRIVATE_KEY }} | |
# 원격 서버에 /home/root/app 디렉토리 생성 | |
- name: Create /home/root/app directory on remote server | |
run: | | |
ssh -o StrictHostKeyChecking=no ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_IP }} "mkdir -p /home/root/app" | |
# 빌드 및 파일 복사 | |
- name: Copy files to /home/root/app directory | |
run: | | |
scp -o StrictHostKeyChecking=no -r ./backend/dist/ ${{ secrets.REMOTE_USER }}@${{ secrets.REMOTE_IP }}:/home/root/app |