Update README.md #77
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: prompterday-CI | |
on: | |
push: | |
branches: [ "develop" ] | |
pull_request: | |
branches: [ "develop" ] | |
jobs: | |
build: | |
name: Build | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout Repository | |
uses: actions/checkout@v3 | |
- name: Setup node.js | |
uses: actions/[email protected] | |
with: | |
node-version: 18.x | |
cache: 'npm' | |
- name: Install Backend-Server | |
run: npm ci | |
- name: Compile Backend-Server | |
run: npm run build | |
# "node_modules/*" "coverage/*" "src/*" "test/*" "README.md" "*.git*" 파일 제외 후 레퍼지토리 압축 | |
- name: Setting .env | |
run: | | |
# .env 파일 생성 및 시크릿 값 설정 | |
echo "PORT=${{ secrets.PORT }}" >> .env | |
echo "OPENAI_MODEL=${{ secrets.OPENAI_MODEL }}" >> .env | |
echo "OPENAI_SECRET_KEY_KIM=${{ secrets.OPENAI_SECRET_KEY_KIM }}" >> .env | |
echo "OPENAI_SECRET_KEY_LEE=${{ secrets.OPENAI_SECRET_KEY_LEE }}" >> .env | |
echo "OPENAI_SECRET_KEY_SUA=${{ secrets.OPENAI_SECRET_KEY_SUA }}" >> .env | |
echo "OPENAI_SECRET_KEY_EUN=${{ secrets.OPENAI_SECRET_KEY_EUN }}" >> .env | |
echo "OPENAI_SECRET_KEY_KIM=${{ secrets.OPENAI_SECRET_KEY_KIM }}" >> .env | |
echo "OPENAI_ORGANIZATION_KEY=${{ secrets.OPENAI_ORGANIZATION_KEY }}" >> .env | |
cat .env | |
- name: Make a zip file | |
run: zip -r ./$GITHUB_SHA.zip . .env -x "node_modules/*" "coverage/*" "src/*" "test/*" "README.md" "*.git*" | |
shell: bash | |
# AWS 자격 증명 수행 | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v2 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ${{ secrets.AWS_REGION }} | |
# zip 파일 S3 업로드 | |
- name: Upload to S3 | |
run: aws s3 cp --region ${{ secrets.AWS_REGION }} ./$GITHUB_SHA.zip s3://$S3_BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip | |
# 코드 배포 | |
- name: Code Deploy | |
run: aws deploy create-deployment | |
--application-name $AWS_CODEDEPLOY_APPLICATION_NAME | |
--deployment-config-name CodeDeployDefault.AllAtOnce | |
--deployment-group-name $AWS_CODEDEPLOY_DEPLOYMENT_GROUP_NAME | |
--s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$PROJECT_NAME/$GITHUB_SHA.zip | |
env: | |
S3_BUCKET_NAME: kimsoo-bucket # S3 버킷 이름 | |
PROJECT_NAME: server-file # S3 버킷 내 폴더 이름 (임의로 설정 가능) | |
AWS_CODEDEPLOY_APPLICATION_NAME: code-deploy # CodeDeploy 애플리케이션 이름 | |
AWS_CODEDEPLOY_DEPLOYMENT_GROUP_NAME: code-deploy-group # CodeDeploy 배포 그룹 이름 | |