Skip to content

feat: ci/cd 구축

feat: ci/cd 구축 #1

Workflow file for this run

name: Java CI with Gradle
#dev 브랜치로 pr할 때 CI 적용
on:
pull_request:
branches: [ "main" ]
types: [ opened, synchronize ]
push: # push 이벤트 발생 시
branches: # 타겟 브랜치
- main
#build 작업
jobs:
build:
#작업이 실행될 환경 지정
runs-on: ubuntu-latest
permissions:
contents: read
#각 단계가 순자적으로 진행
steps:
- uses: actions/checkout@v4
#JDK 17 설치
- name: Set up JDK 17
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
- name: Create main resources directory
run: mkdir -p src/main/resources
- name: Create test resources directory
run: mkdir -p src/test/resources
# main의 application.yml 생성
- name: Set Release YML File
run: |
cd ./src/main/resources
touch ./application.yml
echo "${{ secrets.APPLICATION_YML }}" > ./application.yml
# test의 application.yml 생성
- name: Set Release Test YML File
run: |
cd ./src/test/resources
touch ./application.yml
echo "${{ secrets.APPLICATION_TEST_YML }}" > ./application.yml
#Gradle 설정 및 의존성 다운
- name: Setup Gradle
uses: gradle/actions/setup-gradle@417ae3ccd767c252f5661f1ace9f835f9654f2b5 # v3.1.0
#Permission Denied 해결
- name: Make gradlew executable
run: chmod +x ./gradlew
#빌드 작업 실행(테스트도 같이 진행)
- name: Build with Gradle Wrapper
run: ./gradlew build