Skip to content

Refacor: νšŒμ›κ°€μž… μ‹œ μ•½κ΄€λ™μ˜ 및 μ„ΈλΆ€ 컬럼 μˆ˜μ • #12

Refacor: νšŒμ›κ°€μž… μ‹œ μ•½κ΄€λ™μ˜ 및 μ„ΈλΆ€ 컬럼 μˆ˜μ •

Refacor: νšŒμ›κ°€μž… μ‹œ μ•½κ΄€λ™μ˜ 및 μ„ΈλΆ€ 컬럼 μˆ˜μ • #12

name: suppin dev CI/CD # Workflow 이름
on:
pull_request:
branches:
- dev
types:
- closed
workflow_dispatch: # μˆ˜λ™ 싀행도 κ°€λŠ₯ν•˜λ„λ‘
jobs:
build:
runs-on: ubuntu-latest # OS ν™˜κ²½ μ„ΈνŒ…
if: github.event.pull_request.merged == true && github.event.pull_request.base.ref == 'dev' # PR이 Merge되고, base branchκ°€ dev일 λ•Œλ§Œ μ‹€ν–‰
steps:
- name: Checkout
uses: actions/checkout@v2 # .github 디렉토리 ν•˜μœ„ κ³„μΈ΅μ˜ λͺ¨λ“  μ½”λ“œ 확인
# java μ„€μΉ˜
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
distribution: 'adopt'
java-version: '17'
# aws ν™˜κ²½λ³€μˆ˜ μ„€μ •
- name: Set Environment
uses: microsoft/variable-substitution@v1
with:
files: ./src/main/resources/application.yml
env:
spring.datasource.url: ${{ secrets.DB_URL }}
spring.datasource.username: ${{ secrets.DB_USER }}
spring.datasource.password: ${{ secrets.DB_PASSWORD }}
spring.datasource.driver-class-name: ${{ secrets.DB_DRIVER }}
jwt.token.secret: ${{ secrets.JWT_TOKEN_SECRET }}
jwt.token.expiration: ${{ secrets.ACCESS_EXPIRY_SECONDS }}
# gradlew μ‹€ν–‰ κΆŒν•œ λΆ€μ—¬
- name: Grant execute permission for gradlew
run: chmod +x gradlew
shell: bash
# ν…ŒμŠ€νŠΈλ₯Ό μ œμ™Έν•œ λΉŒλ“œ μ‹œμž‘
- name: Build with Gradle
run: ./gradlew build -x test
shell: bash
- name: Get current time
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DD HH:mm:ss
utcOffset: '+09:00' # build μ‹œμ μ˜ μ‹œκ°„μ„ 기둝
- name: Show current time
run: echo "Current time is ${{ steps.current-time.outputs.time }}"
shell: bash
- name: Generate deployment package
run: |
mkdir -p deploy
cp build/libs/*.jar deploy/application.jar
cp Procfile deploy/Procfile
cp -r .ebextensions_dev deploy/.ebextensions
cp -r .platform deploy/.platform
cd deploy && zip -r deploy.zip .
# AWS Elastic 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 }}
region: 'ap-northeast-2'
application_name: 'suppin-dev'
environment_name: 'Suppin-dev-env'
version_label: github-action-${{ steps.current-time.outputs.formattedTime }}
deployment_package: 'deploy/deploy.zip'
wait_for_deployment: false