Merge pull request #46 from Charge-Control/fix/#45 #4
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: rhkr8521 CICD | |
on: | |
push: | |
branches: [ "develop" ] | |
pull_request: | |
branches: [ "develop" ] | |
permissions: | |
contents: read | |
jobs: | |
# Spring Boot 애플리케이션을 빌드하여 도커허브에 푸시하는 과정 | |
build-docker-image: | |
runs-on: ubuntu-latest | |
steps: | |
- uses: actions/checkout@v3 | |
# 1. Java 17 세팅 | |
- name: Set up JDK 17 | |
uses: actions/setup-java@v3 | |
with: | |
java-version: '17' | |
distribution: 'temurin' | |
# 2. application.yml 파일 생성 | |
- name: Create application.yml | |
run: | | |
mkdir -p src/main/resources | |
echo "${{ secrets.CI_APPLICATION }}" > src/main/resources/application.yml | |
# 3. Spring Boot 애플리케이션 빌드 | |
- name: Build with Gradle | |
uses: gradle/gradle-build-action@v2 | |
with: | |
gradle-executable: ./gradlew | |
# 4. Docker 이미지 빌드 | |
- name: docker image build | |
run: docker build -t ${{ secrets.DOCKERHUB_USERNAME }}/chargecontrol_backend . | |
# 5. DockerHub 로그인 | |
- name: docker login | |
uses: docker/login-action@v2 | |
with: | |
username: ${{ secrets.DOCKERHUB_USERNAME }} | |
password: ${{ secrets.DOCKERHUB_PASSWORD }} | |
# 6. Docker Hub 이미지 푸시 | |
- name: docker Hub push | |
run: docker push ${{ secrets.DOCKERHUB_USERNAME }}/chargecontrol_backend |