Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

.env 파일 전송 #136

Merged
merged 8 commits into from
Nov 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 33 additions & 10 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@ name: Create Directory on Remote Server
on:
push:
branches:
- main
- develop

jobs:
create-directory:
frontend-CD:
runs-on: ubuntu-latest

steps:
Expand Down Expand Up @@ -36,20 +36,43 @@ jobs:
aws configure set aws_secret_access_key $NCLOUD_SECRET_ACCESS_KEY
aws configure set region ap-northeast-2
aws --endpoint-url=https://kr.object.ncloudstorage.com s3 cp ./frontend/dist s3://octodocs/ --recursive --debug
backend-CD:
runs-on: ubuntu-latest

# 패키지 설치 및 Nest.js 빌드
- name: Install dependencies and build
steps:
# 코드 체크아웃
- name: Checkout code
uses: actions/checkout@v3

# .env 파일 생성 후 붙여넣기
- name: Create .env file
run: |
cd backend
npm install
npm run build
echo "${{secrets.DEVELOPMENT_ENV}}" > ./.env
# .env 파일 전송
- name: Copy deploy.sh to remote server
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_DEV_IP }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_PRIVATE_KEY }}
source: ./.env
target: /home/root/app/autodocs

# 배포용 쉘 스크립트 파일 전송
- name: Copy deploy.sh to remote server
uses: appleboy/scp-action@v0.1.1
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_IP }}
host: ${{ secrets.REMOTE_DEV_IP }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_PRIVATE_KEY }}
source: ./deploy.sh
target: /home/root/deploy.sh
target: /home/root
# 쉘 스크립트 실행
- name: Run command on remote server
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_DEV_IP }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_PRIVATE_KEY }}
script: |
sh /home/root/deploy.sh
4 changes: 2 additions & 2 deletions deploy.sh
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ fi

# 의존성 설치 및 애플리케이션 시작
echo "의존성 설치 중..."
npm install
yarn install

echo "애플리케이션 시작 중..."
nohup npm start &
nohup yarn start &
Loading