From de47464dd6d2b6d83beaa16100359b035bb30fb6 Mon Sep 17 00:00:00 2001 From: totobon Date: Tue, 24 Oct 2023 15:59:16 +0900 Subject: [PATCH] yml test --- .github/workflows/nest_lm.yml | 42 ++++++++++++++++++++++++++--------- 1 file changed, 32 insertions(+), 10 deletions(-) diff --git a/.github/workflows/nest_lm.yml b/.github/workflows/nest_lm.yml index 3f4db79..11a4523 100644 --- a/.github/workflows/nest_lm.yml +++ b/.github/workflows/nest_lm.yml @@ -8,11 +8,11 @@ on: branches: [ "main" ] env: - PROJECT_NAME: local_mingle - BUCKET_NAME: s3-bucket-local-mingle - CODE_DEPLOY_APP_NAME: CD-app-local-mingle - DEPLOYMENT_GROUP_NAME: CD-app-group-local-mingle - + PROJECT_NAME: ${{ secrets.PROJECT_NAME }} + BUCKET_NAME: ${{ secrets.BUCKET_NAME }} + CODE_DEPLOY_APP_NAME: ${{ secrets.CODE_DEPLOY_APP_NAME }} + DEPLOYMENT_GROUP_NAME: ${{ secrets.DEPLOYMENT_GROUP_NAME }} + jobs: build: @@ -33,6 +33,28 @@ jobs: - run: npm ci - run: npm run build --if-present + - name: Create .env file + run: | + echo "DATABASE_URL=${{ secrets.DATABASE_URL }}" > .env + echo "JWT_ACCESS_KEY=${{ secrets.JWT_ACCESS_KEY }}" >> .env + echo "JWT_REFRESH_KEY=${{ secrets.JWT_REFRESH_KEY }}" >> .env + echo "KAKAO_CLIENT_ID=${{ secrets.KAKAO_CLIENT_ID }}" >> .env + echo "KAKAO_CLIENT_SECRET=${{ secrets.KAKAO_CLIENT_SECRET }}" >> .env + echo "KAKAO_CALLBACK_URL=${{ secrets.KAKAO_CALLBACK_URL }}" >> .env + echo "EMAIL_USER=${{ secrets.EMAIL_USER }}" >> .env + echo "EMAIL_PASS=${{ secrets.EMAIL_PASS }}" >> .env + echo "AWS_ACCESS_KEY_ID=${{ secrets.AWS_ACCESS_KEY_ID }}" >> .env + echo "AWS_SECRET_ACCESS_KEY=${{ secrets.AWS_PRIVATE_ACCESS_KEY }}" >> .env + echo "AWS_REGION=${{ secrets.AWS_REGION }}" >> .env + echo "AWS_BUCKET_NAME=${{ secrets.AWS_BUCKET_NAME }}" >> .env + echo "GOOGLE_CLIENT_ID=${{ secrets.GOOGLE_CLIENT_ID }}" >> .env + echo "GOOGLE_CLIENT_SECRET=${{ secrets.GOOGLE_CLIENT_SECRET }}" >> .env + echo "GOOGLE_CALLBACK_URL=${{ secrets.GOOGLE_CALLBACK_URL }}" >> .env + echo "NAVER_CLIENT_ID=${{ secrets.NAVER_CLIENT_ID }}" >> .env + echo "NAVER_CLIENT_SECRET=${{ secrets.NAVER_CLIENT_SECRET }}" >> .env + echo "NAVER_CALLBACK_URL=${{ secrets.NAVER_CALLBACK_URL }}" >> .env + working-directory: ./ + # S3로 보낼 압축 파일 생성 - name: zip file run: | @@ -50,16 +72,16 @@ jobs: # 엑세스 시크릿 키 입력 aws-secret-access-key: ${{ secrets.AWS_PRIVATE_ACCESS_KEY }} # 지역 설정: 서울 - aws-region: ap-northeast-2 + aws-region: ${{ secrets.AWS_REGION }} # S3로 업로드하기 - name: upload to S3 - run: aws s3 cp ./$GITHUB_SHA.zip s3://s3-bucket-local-mingle/local_mingle/$GITHUB_SHA.zip + run: aws s3 cp ./$GITHUB_SHA.zip s3://$BUCKET_NAME/$PROJECT_NAME/$GITHUB_SHA.zip # codeDeploy 실행 - name: request deploy to codedeploy run: aws deploy create-deployment - --application-name CD-app-local-mingle + --application-name $CODE_DEPLOY_APP_NAME --deployment-config-name CodeDeployDefault.AllAtOnce - --deployment-group-name CD-app-group-local-mingle - --s3-location bucket=s3-bucket-local-mingle,bundleType=zip,key=local_mingle/$GITHUB_SHA.zip + --deployment-group-name $DEPLOYMENT_GROUP_NAME + --s3-location bucket=$BUCKET_NAME,bundleType=zip,key=$PROJECT_NAME/$GITHUB_SHA.zip