refactor: response 필드 snake case 변환 명시 #27
This file contains hidden or 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 Spring Boot App to EC2 via DockerHub | |
| on: | |
| push: | |
| branches: [main] # main 브랜치에 push가 발생할 때 트리거됨 | |
| workflow_dispatch: | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest # GitHub Actions에서 사용할 runner 환경 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 # 현재 GitHub 레포의 코드 가져오기 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' # OpenJDK 기반 배포판 사용 | |
| - name: Build Spring Boot App | |
| run: ./gradlew clean bootJar # JAR 파일 빌드 | |
| - name: Log in to DockerHub | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKERHUB_USERNAME }} # DockerHub ID | |
| password: ${{ secrets.DOCKERHUB_TOKEN }} # DockerHub Access Token | |
| - name: Build and Push Docker Image | |
| run: | | |
| docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/customs-chatbot:latest . | |
| docker push ${{ secrets.DOCKERHUB_USERNAME }}/customs-chatbot:latest | |
| - 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: Deploy to EC2 via SSM | |
| run: | | |
| aws ssm send-command \ | |
| --document-name "AWS-RunShellScript" \ | |
| --instance-ids "${{ secrets.EC2_INSTANCE_ID }}" \ | |
| --region ap-northeast-2 \ | |
| --comment "Deploy customs-chatbot" \ | |
| --parameters 'commands=[ | |
| "cd /home/ubuntu/CustomsChatBotBE", | |
| "git pull origin main", | |
| "chmod +x deploy.sh", | |
| "./deploy.sh" | |
| ]' \ | |
| --output text |