Skip to content

hotfix: deploy.sh 수정 #63

hotfix: deploy.sh 수정

hotfix: deploy.sh 수정 #63

Workflow file for this run

# 1 워크플로의 이름 지정
name: Production-CI/CD
# 2 워크플로가 시작될 조건 지정
on:
push:
branches: [main]
env:
S3_BUCKET_NAME: fridge-link
CODE_DEPLOY_APPLICATION_NAME: fridge-link
CODE_DEPLOY_DEPLOYMENT_GROUP_NAME: fridge-link-group
jobs:
build:
runs-on: ubuntu-latest # 3 실행 환경 지정
strategy:
matrix:
node-version: [18.x]
#4 실행스텝지정
steps:
- name: Checkout source code.
uses: actions/checkout@v2
- name: Check Node v
run: node -v
- name: Install Dependencies
run: yarn install --frozen-lockfile
# 환경 변수 추가
- name: Set Environment Variables
run: |
echo "NEXT_PUBLIC_KAKAO_API_KEY=${{ secrets.NEXT_PUBLIC_KAKAO_API_KEY }}" >> .env
echo "NEXT_PUBLIC_KAKAO_REDIRECT_URI=${{ secrets.NEXT_PUBLIC_KAKAO_REDIRECT_URI }}" >> .env
echo "NEXT_PUBLIC_GOOGLE_API_KEY=${{ secrets.NEXT_PUBLIC_GOOGLE_API_KEY }}" >> .env
echo "NEXT_PUBLIC_GOOGLE_REDIRECT_URI=${{ secrets.NEXT_PUBLIC_GOOGLE_REDIRECT_URI }}" >> .env
- name: Build
run: yarn build
- name: Make zip file
run: zip -qq -r ./$GITHUB_SHA.zip . -x "node_modules/*"
shell: bash
- name: Configure AWS credentials
uses: aws-actions/configure-aws-credentials@v1
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 ./$GITHUB_SHA.zip s3://${{env.S3_BUCKET_NAME}}/$GITHUB_SHA.zip
- name: Code Deploy
run: |
aws deploy create-deployment \
--deployment-config-name CodeDeployDefault.AllAtOnce \
--application-name ${{ env.CODE_DEPLOY_APPLICATION_NAME }} \
--deployment-group-name ${{ env.CODE_DEPLOY_DEPLOYMENT_GROUP_NAME }} \
--s3-location bucket=${{env.S3_BUCKET_NAME}},bundleType=zip,key=$GITHUB_SHA.zip