Skip to content

chore: cd self-hosted ๋ณ€๊ฒฝ #24

chore: cd self-hosted ๋ณ€๊ฒฝ

chore: cd self-hosted ๋ณ€๊ฒฝ #24

Workflow file for this run

name: Main Branch CI Pipeline
on:
pull_request:
branches:
- main
push:
branches:
- main
jobs:
build:
runs-on: ubuntu-latest
env:
# ๋ฐ์ดํ„ฐ๋ฒ ์ด์Šค ํ™˜๊ฒฝ๋ณ€์ˆ˜ (RDS)
DB_URL: ${{ secrets.DB_URL }}
DB_USERNAME: ${{ secrets.DB_USERNAME }}
DB_PASSWORD: ${{ secrets.DB_PASSWORD }}
## Redis ํ™˜๊ฒฝ๋ณ€์ˆ˜
REDIS_HOST: ${{ secrets.REDIS_HOST }}
REDIS_PORT: ${{ secrets.REDIS_PORT }}
# FCM ํ™˜๊ฒฝ๋ณ€์ˆ˜
BOTTLER_FCM_BASE64: ${{ secrets.BOTTLER_FCM_BASE64 }}
# AWS ํ™˜๊ฒฝ๋ณ€์ˆ˜
AWS_ACCESS_KEY: ${{ secrets.AWS_ACCESS_KEY }}
AWS_SECRET_KEY: ${{ secrets.AWS_SECRET_KEY }}
AWS_REGION: ${{ secrets.AWS_REGION }}
# ECR ํ™˜๊ฒฝ๋ณ€์ˆ˜
ECR_URI: ${{ secrets.ECR_URI }}
# S3 ํ™˜๊ฒฝ๋ณ€์ˆ˜
BUCKET_NAME: ${{ secrets.BUCKET_NAME }}
BASE_URL: ${{ secrets.BASE_URL }}
# gpt ํ™˜๊ฒฝ๋ณ€์ˆ˜
OPENAI_API_KEY: ${{ secrets.OPENAI_API_KEY }}
steps:
- name: ์ฝ”๋“œ ๊ฐ€์ ธ์˜ค๊ธฐ
uses: actions/checkout@v4
- name: JDK 17 ์„ค์ •
uses: actions/setup-java@v4
with:
java-version: 17
distribution: temurin
- name: Build with Gradle
uses: gradle/gradle-build-action@v2.6.0
- name: Execute Gradle build
run: |
cd backend/bottler # ํ”„๋กœ์ ํŠธ ์œ„์น˜์— ๋งž๊ฒŒ ์ถ”ํ›„ ์ˆ˜์ •
./gradlew build
- name: Login to Docker Hub
uses: docker/login-action@v2.2.0
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker Image Build
run: |
cd backend/bottler
docker build --platform linux/arm64/v8 -t l2yupa/bottler -f Dockerfile-dev .
- name: Docker Hub Push
run: docker push l2yupa/bottler
deploy:
runs-on: [self-hosted, Linux, 64]
needs: build
steps:
- name: Pull Latest Docker Image
run: |
sudo docker login --username ${{ secrets.DOCKER_USERNAME }} --password ${{ secrets.DOCKER_PASSWORD }}
sudo docker pull l2yupa/bottler
- name: Docker Compose
run: |
sudo docker run --name spring-baton -p 8080:8080 2023baton/2023baton:latest 1>> build.log 2>> error.log &