Skip to content

feat: .env 파일 보내기 구현 #39

feat: .env 파일 보내기 구현

feat: .env 파일 보내기 구현 #39

Workflow file for this run

name: Create Directory on Remote Server
on:
push:
branches:
- feature-be-#110
jobs:
frontend-CD:
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: "23"
# 패키지 설치 및 React 빌드
- name: Install dependencies and build
run: |
cd frontend
npm install
npm run build
# aws cli를 통해 ncloud object storage 업로드
- name: Configure AWS credentials
env:
NCLOUD_ACCESS_KEY_ID: ${{ secrets.NCLOUD_ACCESS_KEY_ID }}
NCLOUD_SECRET_ACCESS_KEY: ${{ secrets.NCLOUD_SECRET_ACCESS_KEY }}
run: |
aws configure set aws_access_key_id $NCLOUD_ACCESS_KEY_ID
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
steps:
# 코드 체크아웃
- name: Checkout code
uses: actions/checkout@v3
# .env 파일 생성 후 붙여넣기
- name: Create .env file
run: |
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@master
with:
host: ${{ secrets.REMOTE_DEV_IP }}
username: ${{ secrets.REMOTE_USER }}
key: ${{ secrets.REMOTE_PRIVATE_KEY }}
source: ./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