From c816f777204a0860cb77210ba5db463120949fbe Mon Sep 17 00:00:00 2001 From: ParkYunHo Date: Sun, 23 Jul 2023 22:05:15 +0900 Subject: [PATCH] =?UTF-8?q?:sparkles:feature=20:=20prod=20=EB=B0=B0?= =?UTF-8?q?=ED=8F=AC=EC=84=A4=EC=A0=95?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .github/workflows/ci-batch.yaml | 46 +++++++++++++++++++++++++++++++++ .github/workflows/ci.yaml | 3 --- api/build.gradle.kts | 1 + 3 files changed, 47 insertions(+), 3 deletions(-) create mode 100644 .github/workflows/ci-batch.yaml diff --git a/.github/workflows/ci-batch.yaml b/.github/workflows/ci-batch.yaml new file mode 100644 index 0000000..73d6458 --- /dev/null +++ b/.github/workflows/ci-batch.yaml @@ -0,0 +1,46 @@ +name: ci-batch + +on: + workflow_dispatch: + inputs: + job_name: + required: true + type: string + description: 실행할 job 명칭 input + +jobs: + ci-batch: + runs-on: ubuntu-latest + steps: + - name: Git Checkout + uses: actions/checkout@v2 + + - name: Setup JDK + uses: actions/setup-java@v1 + with: + java-version: 17 + + - name: Grant execute permission for gradlew + run: chmod +x gradlew + + - name: Build Gradle + run: + + - name: Dockerhub Login + uses: docker/login-action@v2 + with: + username: ${{ secrets.DOCKERHUB_USERNAME }} + password: ${{ secrets.DOCKERHUB_TOKEN }} + + - name: Build Gradle with JIB (API) + run: ./gradlew clean --stacktrace --build-file=./batch/build.gradle.kts --Dspring.profiles.active=prod --job.name=${{ github.event.inputs.job_name }} build + +# - name: Execute Remote SSH & Deploy 'API' module +# uses: appleboy/ssh-action@master +# with: +# host: ${{ secrets.REMOTE_SSH_HOST }} +# username: ${{ secrets.REMOTE_SSH_USERNAME }} +# key: ${{ secrets.REMOTE_SSH_KEY }} +# script: | +# docker pull johnpark0921/lotto-portfolio +# docker container run --name lotto-portfolio -p 8080:8080 johnpark0921/lotto-portfolio \ No newline at end of file diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index 71c596c..a969405 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -5,9 +5,6 @@ on: tags: - 'v**' -# TODO: -# - gitaction에서 SSH 방식으로 인스턴스 접근해서 image pull & docker run 해보기 - https://doooodle932.tistory.com/163 -# - 수동으로 gitaction 돌릴 수 있도록 설정, if문 설정하면 될듯 (api, batch 별도 배포를 위해) - https://velog.io/@gidskql6671/Github-Actions-Job%EB%93%A4%EC%9D%98-%EC%8B%A4%ED%96%89-%EC%88%9C%EC%84%9C-%EC%A0%95%ED%95%B4%EC%A3%BC%EA%B8%B0 jobs: ci: runs-on: ubuntu-latest diff --git a/api/build.gradle.kts b/api/build.gradle.kts index c26bb92..d8847e1 100644 --- a/api/build.gradle.kts +++ b/api/build.gradle.kts @@ -61,6 +61,7 @@ jib { jvmFlags = listOf( "-Dsun.net.inetaddr.ttl=0", // DNS cache TTL "-XX:+PrintCommandLineFlags", // Print JVM Flags + "-Dspring.profiles.active=prod" // profile 설정 ) } }