Skip to content

fix: .gitignore 설정 및 경로 변경 #78

fix: .gitignore 설정 및 경로 변경

fix: .gitignore 설정 및 경로 변경 #78

Workflow file for this run

name: Build and Deploy to EC2
on:
push:
branches: [ "master" ]
pull_request:
branches: [ "master" ]
defaults:
run:
shell: bash
env:
AWS_S3_BUCKET: howabouttrip-bucket
AWS_CODE_DEPLOY_APPLICATION: HowAboutTrip-CD
AWS_CODE_DEPLOY_GROUP: HowAboutTrip-CD-Group
jobs:
deploy:
runs-on: ubuntu-20.04
steps:
- uses: actions/checkout@v2
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
- name: Grant execute permission for gradlew
working-directory: ./backend
run: chmod +x ./gradlew
shell: bash
- name: Build Project and Test
working-directory: ./backend
run: ./gradlew build test
- name: Setup MySQL
uses: mirromutth/[email protected]
with:
mysql database: 'trip'
mysql user: ${DB_USERNAME}
mysql password: ${DB_PASSWORD}
- name: Configure AWS credential
uses: aws-actions/configure-aws-credentials@v1
with:
aws-region: ap-northeast-2
aws-access-key-id: ${{ secrets.AWS_ACCESS_KEY_ID }}
aws-secret-access-key: ${{ secrets.AWS_SECRET_ACCESS_KEY }}
- name: Upload to S3
working-directory: ./backend
run: aws deploy push --application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} --ignore-hidden-files --s3-location s3://$AWS_S3_BUCKET/HowAboutTrip-EC2/$GITHUB_SHA.zip --source .
- name: Code Deploy to EC2
working-directory: ./backend
run: aws deploy create-deployment --application-name ${{ env.AWS_CODE_DEPLOY_APPLICATION }} --deployment-config-name CodeDeployDefault.AllAtOnce --deployment-group-name ${{ env.AWS_CODE_DEPLOY_GROUP }} --s3-location bucket=$AWS_S3_BUCKET,key=HowAboutTrip-EC2/$GITHUB_SHA.zip,bundleType=zip