Merge pull request #113 from ghdcksgml1/chore(#111)-swagger-config-ex… #20
This file contains 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: Spring Boot & Gradle CI Jobs (With. main branches push) | |
on: | |
push: | |
branches: [ main ] | |
jobs: | |
build: | |
# 실행 환경 (Git Runners 개인 서버) | |
runs-on: self-hosted | |
steps: | |
- uses: actions/checkout@v3 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'adopt' | |
# application.yml 파일 설정 | |
- name: resources 폴더 생성 | |
run: | | |
mkdir -p ./heachi-core/auth-api/src/main/resources | |
mkdir -p ./heachi-core/housework-api/src/main/resources | |
mkdir -p ./heachi-domain-mongo/src/main/resources | |
mkdir -p ./heachi-domain-mysql/src/main/resources | |
mkdir -p ./heachi-domain-redis/src/main/resources | |
mkdir -p ./heachi-notify/src/main/resources | |
mkdir -p ./heachi-support/common/src/main/resources | |
mkdir -p ./heachi-support/external-clients/src/main/resources | |
mkdir -p ./heachi-support/aws-s3/src/main/resources | |
- name: yml 파일 생성 | |
run: | | |
echo "${{ secrets.HEACHICORE_AUTHAPI_APPLICATION }}" > ./heachi-core/auth-api/src/main/resources/application.yml | |
echo "${{ secrets.HEACHICORE_HOUSEWORKAPI_APPLICATION }}" > ./heachi-core/housework-api/src/main/resources/application.yml | |
echo "${{ secrets.HEACHIDOMAINMONGO_APPLICATION }}" > ./heachi-domain-mongo/src/main/resources/application.yml | |
echo "${{ secrets.HEACHIDOMAINMYSQL_DATABASE }}" > ./heachi-domain-mysql/src/main/resources/database.yml | |
echo "${{ secrets.HEACHIDOMAINREDIS_DATABASE }}" > ./heachi-domain-redis/src/main/resources/redis.yml | |
echo "${{ secrets.HEACHINOTIFY_APPLICATION }}" > ./heachi-notify/src/main/resources/application.yml | |
echo "${{ secrets.HEACHISUPPORT_COMMON_COMMON }}" > ./heachi-support/common/src/main/resources/common.yml | |
echo "${{ secrets.HEACHISUPPORT_EXTERNALCLIENTS_APPLICATION }}" > ./heachi-support/external-clients/src/main/resources/application.yml | |
echo "${{ secrets.HEACHISUPPORT_AWS_S3 }}" > ./heachi-support/aws-s3/src/main/resources/s3.yml | |
# docker Build에 필요한 gradle.properties 설정 | |
- name: gradle.properties 생성 | |
run: echo "${{ secrets.GRADLE_PROPERTIES }}" > ./gradle.properties | |
# gradlew를 실행시키기 위해 권한 부여 | |
- name: Gradlew에게 실행권한 부여 | |
run: chmod +x gradlew | |
# 멀티모듈 빌드하기 | |
- name: 멀티모듈 전체 빌드 | |
run: ./gradlew build | |
# Jib을 이용한 도커 이미지 빌드 후 허브 푸쉬 | |
- name: 도커 이미지 빌드 & 도커 허브 푸쉬 | |
run: ./gradlew jib | |
deployment: | |
name: docker deployment | |
needs: build # depends on | |
runs-on: self-hosted | |
steps: | |
- name: executing remote ssh commands using password | |
uses: appleboy/[email protected] | |
with: | |
host: ${{ secrets.HOST }} | |
username: ${{ secrets.USERNAME }} | |
password: ${{ secrets.PASSWORD }} | |
port: ${{ secrets.PORT }} | |
script: ${{ secrets.DOCKER_COMPOSE_DEPLOYMENT_SCRIPT }} # docker-compose 배포 스크립트 실행 |