Skip to content

[BE] 팀 캘린더 하루 일정 조회 구현 #11

[BE] 팀 캘린더 하루 일정 조회 구현

[BE] 팀 캘린더 하루 일정 조회 구현 #11

# Develop 브랜치에 BE코드 머지 시
# 깃헙 러너에서 빌드 후 jar 업로드
# 셀프 호스트 러너에서 jar 다운로드 후 was로 배포
name: backend Java CD with Gradle
on:
pull_request:
types:
- closed
branches: [ "develop" ]
paths:
- 'backend/**'
defaults:
run:
working-directory: backend
permissions:
contents: read
jobs:
build-and-upload:
if: github.event.pull_request.merged == true
runs-on: ubuntu-22.04
env:
DEV_PROPERTY: ${{ secrets.DEV_PROPERTY }}
steps:
- name: Set up Repository
uses: actions/checkout@v3
- name: Change property to dev env
run: |
echo "$DEV_PROPERTY" > src/main/resources/application.yml
- name: Set up JDK 17
uses: actions/setup-java@v3
with:
java-version: '17'
distribution: 'corretto'
- name: Give permission for Gradle
run: chmod +x gradlew
- name: Cache Gradle
id: cache-gradle
uses: actions/cache@v3
with:
path: ~/.gradle/caches
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle') }}
restore-keys: |
${{ runner.os }}-gradle-
- name: Build with Gradle
run: ./gradlew bootJar
- name: Upload jar file artifact
uses: actions/upload-artifact@v3
with:
name: BackendApplicationJar
path: backend/build/libs/*.jar
deploy:
needs: build-and-upload
runs-on: self-hosted
env:
DEV_DEPLOY_SCRIPT: ${{ secrets.DEV_DEPLOY_SCRIPT }}
steps:
- name: Remove previous version jar
working-directory: ./backend/dev/
run: rm -f team-by-team-*.jar
- name: Download jar file from artifact
uses: actions/download-artifact@v3
with:
name: BackendApplicationJar
path: backend/dev/
- name: Deploy to WAS
working-directory: ./backend/dev/
run: |
echo "$DEV_DEPLOY_SCRIPT" > dev-deploy.sh
chmod 700 dev-deploy.sh
./dev-deploy.sh