Merge pull request #40 from LearnMate-Dev/refactor/#39 #23
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: Development-CICD | |
| on: | |
| push: | |
| branches: [ "develop" ] | |
| jobs: | |
| deploy-ci: | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Checkout code | |
| uses: actions/checkout@v3 | |
| - name: Set up JDK 21 (for Kotlin/Spring) | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'corretto' | |
| java-version: '21' | |
| - name: make application-secret.yml | |
| run: | | |
| cat <<EOF > ./src/main/resources/application-secret.yml | |
| ${{ secrets.DEV_APPLICATION_SECRET_YML }} | |
| EOF | |
| shell: bash | |
| - name: make analysis-chat-prompt.txt | |
| run: | | |
| cat <<EOF > ./src/main/resources/analysis-chat-prompt.txt | |
| ${{ secrets.ANALYSIS_CHAT_PROMPT }} | |
| EOF | |
| shell: bash | |
| - name: make chat-prompt.txt | |
| run: | | |
| cat <<EOF > ./src/main/resources/chat-prompt.txt | |
| ${{ secrets.CHAT_PROMPT }} | |
| EOF | |
| shell: bash | |
| - name: make recommend-subject-prompt.txt | |
| run: | | |
| cat <<EOF > ./src/main/resources/recommend-subject-prompt.txt | |
| ${{ secrets.RECOMMEND_SUBJECT_PROMPT }} | |
| EOF | |
| shell: bash | |
| - name: make analysis-feedback-prompt.txt | |
| run: | | |
| cat <<EOF > ./src/main/resources/analysis-feedback-prompt.txt | |
| ${{ secrets.ANALYSIS_FEEDBACK_PROMPT }} | |
| EOF | |
| shell: bash | |
| - name: make analysis-spelling-prompt.txt | |
| run: | | |
| cat <<EOF > ./src/main/resources/analysis-spelling-prompt.txt | |
| ${{ secrets.ANALYSIS_SPELLING_PROMPT }} | |
| EOF | |
| shell: bash | |
| - name: build with gradle | |
| run: | | |
| chmod +x gradlew | |
| ./gradlew build -x test | |
| - name: set env for docker build | |
| uses: docker/setup-buildx-action@v2 | |
| - name: dockerHub login | |
| uses: docker/login-action@v2 | |
| with: | |
| username: ${{ secrets.DOCKER_USERNAME }} | |
| password: ${{ secrets.DOCKER_ACCESS_TOKEN }} | |
| - name: Docker 이미지 빌드 및 푸시 | |
| run: | | |
| IMAGE=${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:dev | |
| docker build --platform linux/amd64 -t $IMAGE . | |
| docker push $IMAGE | |
| deploy-cd: | |
| needs: deploy-ci | |
| runs-on: ubuntu-24.04 | |
| steps: | |
| - name: Deploy to EC2 | |
| uses: appleboy/[email protected] | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USER }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script: | | |
| IMAGE=${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }}:dev | |
| docker pull $IMAGE | |
| docker stop ${{ secrets.DOCKER_REPOSITORY }} || true | |
| docker rm ${{ secrets.DOCKER_REPOSITORY }} || true | |
| docker run -d --name ${{ secrets.DOCKER_REPOSITORY }} -p 8080:8080 $IMAGE |