From 0cddcbd450015313e8cae9fbf6b338cbf3303f66 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EA=B2=BD=EB=AF=B8?= <109158497+kyum-q@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:22:17 +0900 Subject: [PATCH 1/4] =?UTF-8?q?refactor(workflows):=20=20CI=20self-hosted-?= =?UTF-8?q?runner=EC=97=90=EC=84=9C=20=ED=95=98=EB=8F=84=EB=A1=9D=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/backend_ci.yml | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 363a502be..05a1f27dd 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -6,10 +6,11 @@ on: - dev/be - develop - main - + jobs: build: - runs-on: ubuntu-latest + runs-on: self-hosted + steps: - name: 체크아웃 uses: actions/checkout@v4 @@ -23,13 +24,11 @@ jobs: path: /h2-console datasource: url: jdbc:h2:mem:database" > backend/src/main/resources/application.yml - - - name: JDK 17 설정 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - name: 테스트 코드 실행 run: ./gradlew test working-directory: ./backend + + - name: 클린업 + if: always() + run: rm -rf ../2024-code-zap/* From 11cebac5ba06ced8adafdf7a92ccef8f542339d2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EA=B2=BD=EB=AF=B8?= <109158497+kyum-q@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:42:35 +0900 Subject: [PATCH 2/4] =?UTF-8?q?refactor(workflows):=20cd=20=ED=8C=8C?= =?UTF-8?q?=EC=9D=B4=ED=94=84=EB=9D=BC=EC=9D=B8=EB=8F=84=20=EB=AA=A8?= =?UTF-8?q?=EB=91=90=20self-hosted-runner=EC=97=90=EC=84=9C=20=EC=A7=84?= =?UTF-8?q?=ED=96=89=ED=95=98=EB=8F=84=EB=A1=9D=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/backend_cd.yml | 53 +++++++++++++------------------- 1 file changed, 21 insertions(+), 32 deletions(-) diff --git a/.github/workflows/backend_cd.yml b/.github/workflows/backend_cd.yml index a472fb2c1..ada15fb2e 100644 --- a/.github/workflows/backend_cd.yml +++ b/.github/workflows/backend_cd.yml @@ -7,38 +7,34 @@ on: - main jobs: + find-branch: + runs-on: self-hosted + steps: + - name: 브랜치명을 통해 개발 환경 알아내기 + run: | + cd ${{ secrets.SCRIPT_DIRECTORY }} + bash find-env-by-branch.sh + build: - runs-on: ubuntu-latest + needs: find-branch + runs-on: self-hosted steps: - name: 체크아웃 uses: actions/checkout@v4 - - - name: JDK 17 설정 - uses: actions/setup-java@v4 - with: - java-version: 17 - distribution: temurin - + - name: gradle 캐싱 - uses: actions/cache@v3 - with: - path: | - ~/.gradle/caches - ~/.gradle/wrapper - key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} - restore-keys: | - ${{ runner.os }}-gradle- + uses: gradle/actions/setup-gradle@v3 - name: bootJar로 jar 파일 생성 - run: ./gradlew bootJar + run: | + ./gradlew bootJar + mv build/libs/*.jar ${{ secrets.WORK_DIRECTORY }}/${{ env.ENVIRONMENT }} working-directory: ./backend - - - name: jar 파일 Artifact로 업로드 - uses: actions/upload-artifact@v4 - with: - name: code-zap-jar - path: backend/build/libs/*.jar - + + - name: 클린업 + if: always() + run: rm -rf ../2024-code-zap/* + deploy: needs: build runs-on: self-hosted @@ -48,12 +44,6 @@ jobs: cd ${{ secrets.SCRIPT_DIRECTORY }} bash find-env-by-branch.sh - - name: Artifact 다운로드 - uses: actions/download-artifact@v4 - with: - name: code-zap-jar - path: ${{ secrets.WORK_DIRECTORY }}/${{ env.ENVIRONMENT }} - - name: 실행 프로세스 확인 run: | cd ${{ secrets.SCRIPT_DIRECTORY }} @@ -61,8 +51,6 @@ jobs: - name: 배포 스크립트 실행 run: | - cd ${{ secrets.WORK_DIRECTORY }} - unzip -o code-zap-jar.zip cd ${{ secrets.SCRIPT_DIRECTORY }} RUNNER_TRACKING_ID="" && bash start.sh ${{ env.ENVIRONMENT }} @@ -70,3 +58,4 @@ jobs: run: | cd ${{ secrets.SCRIPT_DIRECTORY }} bash verify-deploy.sh + From c9b0fe59f64195b3c1909cb164db4977faa2263f Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EA=B2=BD=EB=AF=B8?= <109158497+kyum-q@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:50:30 +0900 Subject: [PATCH 3/4] =?UTF-8?q?refactor(workflows):=20=20workflow=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/backend_cd.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/backend_cd.yml b/.github/workflows/backend_cd.yml index ada15fb2e..d393c89f7 100644 --- a/.github/workflows/backend_cd.yml +++ b/.github/workflows/backend_cd.yml @@ -1,4 +1,4 @@ -name: 백엔드 CD +name: Backend CD on: push: From 05be2eb7324d749057b19f8c305b00357e5f1c57 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EA=B9=80=EA=B2=BD=EB=AF=B8?= <109158497+kyum-q@users.noreply.github.com> Date: Mon, 5 Aug 2024 16:50:42 +0900 Subject: [PATCH 4/4] =?UTF-8?q?refactor(workflows):=20=20workflow=20?= =?UTF-8?q?=EC=9D=B4=EB=A6=84=20=EB=B3=80=EA=B2=BD?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/backend_ci.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/backend_ci.yml b/.github/workflows/backend_ci.yml index 05a1f27dd..0c4153c9e 100644 --- a/.github/workflows/backend_ci.yml +++ b/.github/workflows/backend_ci.yml @@ -1,4 +1,4 @@ -name: 백엔드 CI +name: Backend CI on: pull_request: