Skip to content

Merge pull request #758 from woowacourse-teams/chore/#754 #209

Merge pull request #758 from woowacourse-teams/chore/#754

Merge pull request #758 from woowacourse-teams/chore/#754 #209

name: CI CD dev
on:
push:
branches:
- develop-backend
jobs:
build:
runs-on: ubuntu-24.04
defaults:
run:
shell: bash
working-directory: ./backend
steps:
- name: 레포지토리 체크아웃
uses: actions/checkout@v4
- name: JDK 17을 설치
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'corretto'
- name: Firebase 파일 이동
run: |
mkdir -p src/main/resources/firebase
echo ${{ secrets.BACKEND_FIREBASE_JSON }} > src/main/resources/firebase/serviceAccountKey.json
- name: Apple Auth Key 파일 이동
run: |
mkdir -p src/main/resources/auth
printf "%s" "${{ secrets.APPLE_AUTH_KEY }}" > src/main/resources/auth/AuthKey.p8
- name: gradlew 권한 부여
run: chmod +x ./gradlew
- name: Gradle 빌드
run: ./gradlew clean build
- name: DockerHub 로그인
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: 도커 이미지 빌드 및 푸시
run: |
docker buildx build ./ --platform=linux/arm64 -t 2024mouda/mouda-be:latest
docker push 2024mouda/mouda-be:latest
deploy:
needs: build
runs-on: [self-hosted, develop]
steps:
- name: DockerHub login
uses: docker/login-action@v1
with:
username: ${{ secrets.DOCKER_USERNAME }}
password: ${{ secrets.DOCKER_PASSWORD }}
- name: Docker Compose up
run: |
cd ~/deploy
docker compose -f docker-compose-be.yml down
docker compose -f docker-compose-be.yml pull
docker compose -f docker-compose-be.yml up -d