Skip to content

Merge pull request #69 from LocalMingle/dev #47

Merge pull request #69 from LocalMingle/dev

Merge pull request #69 from LocalMingle/dev #47

Workflow file for this run

# 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: s3-bucket-local-mingle
CODE_DEPLOY_APP_NAME: CD-app-local-mingle
DEPLOYMENT_GROUP_NAME: CD-app-group-local-mingle
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
node-version: [18.x]
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/
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
# S3로 보낼 압축 파일 생성
- name: zip file
run: |
# zip으로 압축파일 생성
# CI.zip은 압축 파일 이름, 나머지는 압축할 코드 파일 또는 폴더를 지정합니다.
# workflow와 동일한 위치의 폴더와 파일을 압축합니다.
zip -qq -r ./$GITHUB_SHA.zip .
# AWS 인증하기
- name: AWS configure credentials
uses: aws-actions/configure-aws-credentials@v1
with:
# 엑세스 키 입력
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
# 엑세스 시크릿 키 입력
aws-secret-access-key: ${{ secrets.AWS_PRIVATE_ACCESS_KEY }}
# 지역 설정: 서울
aws-region: ap-northeast-2
# 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 CD-app-local-mingle
--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