Merge pull request #47 from TEAM-ITERVIEW/#46 #31
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: [main] | |
jobs: | |
build-and-deploy: | |
runs-on: ubuntu-20.04 | |
strategy: | |
matrix: | |
node-version: [18.12.1] | |
# See supported Node.js release schedule at https://nodejs.org/en/about/releases/ | |
steps: | |
- name: ✅ 체크아웃 source code. | |
uses: actions/checkout@v3 | |
- name: ⚙️ ${{ matrix.node-version }} 버전의 노드로 세팅합니다. | |
uses: actions/setup-node@v3 | |
with: | |
node-version: ${{ matrix.node-version }} | |
- name: ⚙️ 환경변수를 설정합니다. | |
working-directory: ./ | |
run: | | |
pwd | |
touch .env | |
echo DATABASE_URL=${{ secrets.DATABASE_URL }} >> .env | |
cat .env | |
- name: ✨ 패키지 설치 | |
working-directory: ./ | |
run: yarn | |
- name: ✨ 빌드 과정을 시작 | |
working-directory: ./ | |
run: yarn run build | |
- name: 📦 빌드한 코드를 압축 | |
run: zip -r iterview.zip ./dist ./scripts ./appspec.yml ./.env ./package.json ./prisma | |
- name: 🌎 AWS에 접속 | |
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: 🦖 S3에 압축된 서버 코드를 업로드 | |
run: aws s3 cp --region ap-northeast-2 ./iterview.zip s3://iterview/deploy/ | |
- name: 🚀 AWS codeDeploy로 배포를 시작 | |
run: aws deploy create-deployment | |
--application-name iterview-codedeploy | |
--deployment-config-name CodeDeployDefault.OneAtATime | |
--deployment-group-name dev | |
--s3-location bucket=iterview,bundleType=zip,key=deploy/iterview.zip |