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/ci-dev.yml b/.github/workflows/cicd-backend-dev.yml similarity index 58% rename from .github/workflows/ci-dev.yml rename to .github/workflows/cicd-backend-dev.yml index e7c55af50..e22dfaf56 100644 --- a/.github/workflows/ci-dev.yml +++ b/.github/workflows/cicd-backend-dev.yml @@ -1,7 +1,7 @@ -name: ci-dev +name: CI CD dev on: - pull_request: + push: branches: - develop-backend @@ -40,3 +40,24 @@ jobs: 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 diff --git a/.github/workflows/pr-test.yml b/.github/workflows/pr-test.yml new file mode 100644 index 000000000..6eaaa538f --- /dev/null +++ b/.github/workflows/pr-test.yml @@ -0,0 +1,31 @@ +name: pull-request-build + +on: + pull_request: + 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