Skip to content

Update ci.yml

Update ci.yml #5

Workflow file for this run

name: CI Pipeline
on:
push:
branches:
- main
pull_request:
branches:
- main
jobs:
build-and-deploy:
runs-on: ubuntu-latest
steps:
# 1. 코드 체크아웃
- name: Checkout code
uses: actions/checkout@v3
# 2. Java 21 환경 설정
- name: Set up JDK 21
uses: actions/setup-java@v3
with:
distribution: 'temurin'
java-version: '21'
# 3. Gradle 빌드
- name: Grant execute permission to Gradlew
run: chmod +x ./discordchatbot/gradlew
- name: Build with Gradle
run: ./discordchatbot/gradlew clean build -x test
# 4. Docker 이미지 빌드
- name: Build and push Docker image
working-directory: discordchatbot # 작업 디렉토리 설정
run: |
docker build \
--build-arg DB_USER=${{ secrets.DB_USER }} \
--build-arg DB_PASSWORD=${{ secrets.DB_PASSWORD }} \
-t mirlee/discordchatbot:latest .
# 5. Docker Hub 로그인
- name: Log in to Docker Hub
uses: docker/login-action@v2
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
# 6. Docker 이미지 푸시
- name: Push Docker Image
working-directory: discordchatbot # 작업 디렉토리 설정
run: |
docker push mirlee/discordchatbot:latest