fix: 오류 해결 (#135) #58
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: Deploy | |
on: | |
push: | |
branches: | |
- develop | |
env: | |
PROJECT_NAME: orury-front | |
S3_BUCKET_NAME: orury-bepo-bucket | |
CODE_DEPLOY_APPLICATION_NAME: orury-code-deploy | |
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: orury-client-deploy-group | |
jobs: | |
build: | |
environment: develop | |
runs-on: ubuntu-latest | |
steps: | |
- name: Checkout source code. | |
uses: actions/checkout@v3 | |
- name: Check Node v | |
run: node -v | |
- name: Generate Environment Variables File | |
run: | | |
run: | | |
echo "NEXT_PUBLIC_MODE=$NEXT_PUBLIC_MODE" >> .env.development | |
echo "NEXT_PUBLIC_API_URL=$NEXT_PUBLIC_API_URL" >> .env.development | |
echo "NEXT_PUBLIC_KAKAO_APP_KEY=$NEXT_PUBLIC_KAKAO_APP_KEY" >> .env.development | |
echo "KAKAO_CLIENT_ID=$KAKAO_CLIENT_ID" >> .env.development | |
echo "KAKAO_CLIENT_SECRET=$KAKAO_CLIENT_SECRET" >> .env.development | |
echo "NEXT_PUBLIC_API_MOCKING=$NEXT_PUBLIC_API_MOCKING" >> .env.development | |
echo "NEXTAUTH_SECRET=$NEXTAUTH_SECRET" >> .env.development | |
echo "NEXTAUTH_URL=$NEXTAUTH_URL" >> .env.development | |
echo "NEXT_PUBLIC_CRYPTO_KEY=$NEXT_PUBLIC_CRYPTO_KEY" >> .env.development | |
env: | |
NEXT_PUBLIC_MODE: ${{ secrets.NEXT_PUBLIC_MODE }} | |
NEXT_PUBLIC_API_URL: ${{ secrets.NEXT_PUBLIC_API_URL }} | |
NEXT_PUBLIC_KAKAO_APP_KEY: ${{ secrets.NEXT_PUBLIC_KAKAO_APP_KEY }} | |
KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }} | |
KAKAO_CLIENT_SECRET: ${{ secrets.KAKAO_CLIENT_SECRET }} | |
NEXT_PUBLIC_API_MOCKING: ${{ secrets.NEXT_PUBLIC_API_MOCKING }} | |
NEXTAUTH_SECRET: ${{ secrets.NEXTAUTH_SECRET }} | |
NEXTAUTH_URL: ${{ secrets.NEXTAUTH_URL }} | |
NEXT_PUBLIC_CRYPTO_KEY: <span class="math-inline">\{\{ secrets\.NEXT\_PUBLIC\_CRYPTO\_KEY \}\} | |
- name: Cache node modules | |
uses: actions/cache@v3 | |
id: cache | |
with: | |
# node_modules라는 폴더를 검사하여 | |
path: node_modules | |
# 아래 키값으로 cache가 돼있는지 확인합니다. | |
key: npm-packages-${{ hashFiles('**/package-lock.json') }} | |
- name: Install Dependencies | |
if: steps.cache.outputs.cache-hit != 'true' | |
run: npm install | |
- name: Build | |
run: | | |
npm run build:dev | |
- name: zip create | |
run: | | |
zip -qq -r --symlinks ./orury-dev.zip . | |
shell: bash | |
- name: Configure AWS credentials | |
uses: aws-actions/configure-aws-credentials@v1-node16 | |
with: | |
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }} | |
aws-region: ap-northeast-2 | |
- name: Upload to S3 | |
run: | | |
aws s3 cp --region ap-northeast-2 ./orury-dev.zip s3://$S3_BUCKET_NAME/$PROJECT_NAME/orury-dev.zip | |
- name: Deploy For Development | |
run: aws deploy create-deployment --application-name $CODE_DEPLOY_APPLICATION_NAME --deployment-config-name CodeDeployDefault.OneAtATime --deployment-group-name $CODE_DEPLOY_DEPLOYMENT_GROUP_NAME --s3-location bucket=$S3_BUCKET_NAME,bundleType=zip,key=$PROJECT_NAME/orury-dev.zip |