From 06f1ebd8b26370219850fdcab1c86c06290c7df2 Mon Sep 17 00:00:00 2001 From: ay-eonii Date: Thu, 25 Jul 2024 14:14:45 +0900 Subject: [PATCH 1/2] =?UTF-8?q?feat:=20pr=20=ED=85=8C=EC=8A=A4=ED=8A=B8=20?= =?UTF-8?q?=EC=B6=94=EA=B0=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/{ci-dev.yml => pr-test.yml} | 13 +------------ 1 file changed, 1 insertion(+), 12 deletions(-) rename .github/workflows/{ci-dev.yml => pr-test.yml} (58%) diff --git a/.github/workflows/ci-dev.yml b/.github/workflows/pr-test.yml similarity index 58% rename from .github/workflows/ci-dev.yml rename to .github/workflows/pr-test.yml index e7c55af50..6eaaa538f 100644 --- a/.github/workflows/ci-dev.yml +++ b/.github/workflows/pr-test.yml @@ -1,4 +1,4 @@ -name: ci-dev +name: pull-request-build on: pull_request: @@ -29,14 +29,3 @@ jobs: - 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 From f5b105b5e9323bee660377c7a3e2a62c230fd0a9 Mon Sep 17 00:00:00 2001 From: ay-eonii Date: Thu, 25 Jul 2024 14:15:09 +0900 Subject: [PATCH 2/2] =?UTF-8?q?fix:=20cicd=20=EC=8B=9C=EA=B8=B0=20?= =?UTF-8?q?=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/cd-dev.yml | 27 ----------- .github/workflows/cicd-backend-dev.yml | 63 ++++++++++++++++++++++++++ 2 files changed, 63 insertions(+), 27 deletions(-) delete mode 100644 .github/workflows/cd-dev.yml create mode 100644 .github/workflows/cicd-backend-dev.yml diff --git a/.github/workflows/cd-dev.yml b/.github/workflows/cd-dev.yml deleted file mode 100644 index 32902094a..000000000 --- a/.github/workflows/cd-dev.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: cd-dev - -on: - push: - branches: - - develop-backend - -jobs: - deploy: - runs-on: self-hosted - - steps: - - name: change permission - run: | - sudo chown -R ubuntu:ubuntu /home/ubuntu/actions-runner/_work/2024-mouda - - - name: DockerHub login - uses: docker/login-action@v1 - with: - username: ${{ secrets.DOCKER_USERNAME }} - password: ${{ secrets.DOCKER_PASSWORD }} - - - name: Docker Compose up - run: | - docker compose -f ./backend/docker-compose.yml down mouda-be - docker compose -f ./backend/docker-compose.yml pull mouda-be - docker compose -f ./backend/docker-compose.yml up -d mouda-be diff --git a/.github/workflows/cicd-backend-dev.yml b/.github/workflows/cicd-backend-dev.yml new file mode 100644 index 000000000..e22dfaf56 --- /dev/null +++ b/.github/workflows/cicd-backend-dev.yml @@ -0,0 +1,63 @@ +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: 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 + + steps: + - name: change permission + run: | + sudo chown -R ubuntu:ubuntu /home/ubuntu/actions-runner/_work/2024-mouda + + - name: DockerHub login + uses: docker/login-action@v1 + with: + username: ${{ secrets.DOCKER_USERNAME }} + password: ${{ secrets.DOCKER_PASSWORD }} + + - name: Docker Compose up + run: | + docker compose -f ./backend/docker-compose.yml down mouda-be + docker compose -f ./backend/docker-compose.yml pull mouda-be + docker compose -f ./backend/docker-compose.yml up -d mouda-be