Merge pull request #174 from Project-BookLog/feat/135/detail #116
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: BookLog Dev CI/CD | |
| on: | |
| push: | |
| branches: [ dev ] # dev 브랜치에 push될 때 실행 | |
| workflow_dispatch: # 수동 실행 버튼 활성화 | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - name: Checkout | |
| uses: actions/checkout@v3 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v3 | |
| with: | |
| distribution: 'temurin' | |
| java-version: '17' | |
| # 1. application.yml 생성 경로 수정 | |
| - name: Make application.yml | |
| run: | | |
| mkdir -p ./booklog/src/main/resources | |
| echo "${{ secrets.APPLICATION_YML }}" > ./booklog/src/main/resources/application.yml | |
| shell: bash | |
| # 2. gradlew 권한 부여 경로 수정 | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x ./booklog/gradlew | |
| # 3. Gradle 빌드 (작업 디렉토리 지정 필수) | |
| - name: Build with Gradle | |
| working-directory: ./booklog | |
| run: ./gradlew clean build -x test | |
| # 4. 배포 패키지 생성 (EB용) | |
| - name: Generate deployment package | |
| run: | | |
| mkdir -p deploy/.ebextensions | |
| mkdir -p deploy/.platform | |
| cp booklog/build/libs/booklog.jar deploy/application.jar | |
| cp -r .ebextensions_dev/* deploy/.ebextensions/ | |
| cp -r .platform/* deploy/.platform/ | |
| echo 'web: java -jar application.jar' > deploy/Procfile | |
| cd deploy && zip -r deploy.zip . | |
| # 5. Beanstalk 배포 | |
| - name: Beanstalk Deploy | |
| uses: einaregilsson/beanstalk-deploy@v20 | |
| with: | |
| aws_access_key: ${{ secrets.AWS_ACTION_ACCESS_KEY_ID }} | |
| aws_secret_key: ${{ secrets.AWS_ACTION_SECRET_ACCESS_KEY }} | |
| application_name: booklog-dev # 실제 EB 앱 이름 확인 | |
| environment_name: Booklog-dev-env # 실제 EB 환경 이름 확인 | |
| version_label: github-action-${{ github.sha }}-${{ github.run_number }} | |
| region: ap-northeast-2 # 리전 확인 (보통 서울) | |
| deployment_package: deploy/deploy.zip | |
| wait_for_deployment: true | |
| use_existing_version_if_available: true |