Merge pull request #67 from LocalMingle/dev #44
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
# This workflow will do a clean installation of node dependencies, cache/restore them, build the source code and run tests across different versions of node | |
# For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-nodejs | |
name: nest_lm CI | |
on: | |
push: | |
branches: [ "main" ] | |
env: | |
PROJECT_NAME: local_mingle | |
BUCKET_NAME: ${{ secrets.BUCKET_NAME }} | |
CODE_DEPLOY_APP_NAME: ${{ secrets.CODE_DEPLOY_APP_NAME }} | |
DEPLOYMENT_GROUP_NAME: ${{ secrets.DEPLOYMENT_GROUP_NAME }} | |
jobs: | |
build: | |
runs-on: ubuntu-latest | |
strategy: | |
matrix: | |
node-version: [18.x] | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Use Node.js ${{ matrix.node-version }} | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
cache: 'npm' | |
- run: npm ci | |
- run: npm run build --if-present | |
# .env 파일 생성 | |
- name: Create .env | |
run: | | |
echo "DATABASE_URL=$DATABASE_URL" > .env | |
echo "JWT_ACCESS_KEY=$JWT_ACCESS_KEY" >> .env | |
echo "JWT_REFRESH_KEY=$JWT_REFRESH_KEY" >> .env | |
echo "KAKAO_CLIENT_ID=$KAKAO_CLIENT_ID" >> .env | |
echo "KAKAO_CLIENT_SECRET=$KAKAO_CLIENT_SECRET" >> .env | |
echo "KAKAO_CALLBACK_URL=$KAKAO_CALLBACK_URL" >> .env | |
echo "EMAIL_USER=$EMAIL_USER" >> .env | |
echo "EMAIL_PASS=$EMAIL_PASS" >> .env | |
echo "AWS_ACCESS_KEY_ID=$AWS_ACCESS_KEY_ID" >> .env | |
echo "AWS_SECRET_ACCESS_KEY=$AWS_SECRET_ACCESS_KEY" >> .env | |
echo "AWS_REGION=$AWS_REGION" >> .env | |
echo "AWS_BUCKET_NAME=$AWS_BUCKET_NAME" >> .env | |
echo "GOOGLE_CLIENT_ID=$GOOGLE_CLIENT_ID" >> .env | |
echo "GOOGLE_CLIENT_SECRET=$GOOGLE_CLIENT_SECRET" >> .env | |
echo "GOOGLE_CALLBACK_URL=$GOOGLE_CALLBACK_URL" >> .env | |
echo "NAVER_CLIENT_ID=$NAVER_CLIENT_ID" >> .env | |
echo "NAVER_CLIENT_SECRET=$NAVER_CLIENT_SECRET" >> .env | |
echo "NAVER_CALLBACK_URL=$NAVER_CALLBACK_URL" >> .env | |
env: | |
DATABASE_URL: ${{ secrets.DATABASE_URL }} | |
JWT_ACCESS_KEY: ${{ secrets.JWT_ACCESS_KEY }} | |
JWT_REFRESH_KEY: ${{ secrets.JWT_REFRESH_KEY }} | |
KAKAO_CLIENT_ID: ${{ secrets.KAKAO_CLIENT_ID }} | |
KAKAO_CLIENT_SECRET: ${{ secrets.KAKAO_CLIENT_SECRET }} | |
KAKAO_CALLBACK_URL: ${{ secrets.KAKAO_CALLBACK_URL }} | |
EMAIL_USER: ${{ secrets.EMAIL_USER }} | |
EMAIL_PASS: ${{ secrets.EMAIL_PASS }} | |
AWS_ACCESS_KEY_ID: ${{ secrets.AWS_ACCESS_KEY_ID }} | |
AWS_SECRET_ACCESS_KEY: ${{ secrets.AWS_PRIVATE_ACCESS_KEY }} | |
AWS_REGION: ${{ secrets.AWS_REGION }} | |
AWS_BUCKET_NAME: ${{ secrets.BUCKET_NAME }} | |
GOOGLE_CLIENT_ID: ${{ secrets.GOOGLE_CLIENT_ID }} | |
GOOGLE_CLIENT_SECRET: ${{ secrets.GOOGLE_CLIENT_SECRET }} | |
GOOGLE_CALLBACK_URL: ${{ secrets.GOOGLE_CALLBACK_URL }} | |
NAVER_CLIENT_ID: ${{ secrets.NAVER_CLIENT_ID }} | |
NAVER_CLIENT_SECRET: ${{ secrets.NAVER_CLIENT_SECRET }} | |
NAVER_CALLBACK_URL: ${{ secrets.NAVER_CALLBACK_URL }} | |
# S3로 업로드하기 | |
- name: upload to S3 | |
run: aws s3 cp ./$GITHUB_SHA.zip s3://s3-bucket-local-mingle/local_mingle/$GITHUB_SHA.zip | |
# codeDeploy 실행 | |
- name: request deploy to codedeploy | |
run: aws deploy create-deployment | |
--application-name $CODE_DEPLOY_APP_NAME | |
--deployment-config-name CodeDeployDefault.AllAtOnce | |
--deployment-group-name $DEPLOYMENT_GROUP_NAME | |
--s3-location bucket=$BUCKET_NAME,bundleType=zip,key=local_mingle/$GITHUB_SHA.zip |