Skip to content

Commit

Permalink
✨feature : batch 빌드방식 변경
Browse files Browse the repository at this point in the history
  • Loading branch information
ParkYunHo committed Jul 26, 2023
1 parent a154571 commit 026c790
Show file tree
Hide file tree
Showing 3 changed files with 61 additions and 13 deletions.
25 changes: 20 additions & 5 deletions .github/workflows/drwtStore-batch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,23 @@ jobs:
- name: Build Gradle
run: ./gradlew clean --stacktrace --build-file=./batch/build.gradle.kts --exclude-task test build

- name: Job Execute
run: java -Dspring.profiles.active=prod -jar ./batch/build/libs/batch-0.0.1-SNAPSHOT.jar --spring.batch.job.names=lottoDrwtStoreJob --startDrwtNo=$START_DRWTNO --endDrwtNo=$END_DRWTNO
env:
START_DRWTNO: ${{ inputs.startDrwtNo }}
END_DRWTNO: ${{ inputs.endDrwtNo }}
- name: Upload JAR To Instance
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_SSH_HOST }}
username: ${{ secrets.REMOTE_SSH_USERNAME }}
key: ${{ secrets.REMOTE_SSH_KEY }}
source: "./batch/build/libs/batch-0.0.1-SNAPSHOT.jar"
target: "/home/opc/drwt-store-deploy"

- name: Execute Job with Remote SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_SSH_HOST }}
username: ${{ secrets.REMOTE_SSH_USERNAME }}
key: ${{ secrets.REMOTE_SSH_KEY }}
script: |
echo jobName=lottoDrwtStoreJob startDrwtNo=${{ inputs.startDrwtNo }} endDrwtNo=${{ inputs.endDrwtNo }}
ls ~/drwt-store-deploy/batch/build/libs -all
java -Dspring.profiles.active=prod -jar ~/drwt-store-deploy/batch/build/libs/batch-0.0.1-SNAPSHOT.jar --job.name=lottoDrwtStoreJob --startDrwtNo=${{ inputs.startDrwtNo }} --endDrwtNo=${{ inputs.endDrwtNo }}
rm -rf ~/drwt-store-deploy
25 changes: 20 additions & 5 deletions .github/workflows/number-batch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,23 @@ jobs:
- name: Build Gradle
run: ./gradlew clean --stacktrace --build-file=./batch/build.gradle.kts --exclude-task test build

- name: Job Execute
run: java -Dspring.profiles.active=prod -jar ./batch/build/libs/batch-0.0.1-SNAPSHOT.jar --spring.batch.job.names=lottoNumberJob --startDrwtNo=$START_DRWTNO --endDrwtNo=$END_DRWTNO
env:
START_DRWTNO: ${{ inputs.startDrwtNo }}
END_DRWTNO: ${{ inputs.endDrwtNo }}
- name: Upload JAR To Instance
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_SSH_HOST }}
username: ${{ secrets.REMOTE_SSH_USERNAME }}
key: ${{ secrets.REMOTE_SSH_KEY }}
source: "./batch/build/libs/batch-0.0.1-SNAPSHOT.jar"
target: "/home/opc/num-deploy"

- name: Execute Job with Remote SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_SSH_HOST }}
username: ${{ secrets.REMOTE_SSH_USERNAME }}
key: ${{ secrets.REMOTE_SSH_KEY }}
script: |
echo jobName=lottoNumberJob startDrwtNo=${{ inputs.startDrwtNo }} endDrwtNo=${{ inputs.endDrwtNo }}
ls ~/num-deploy/batch/build/libs -all
java -Dspring.profiles.active=prod -jar ~/num-deploy/batch/build/libs/batch-0.0.1-SNAPSHOT.jar --job.name=lottoNumberJob --startDrwtNo=${{ inputs.startDrwtNo }} --endDrwtNo=${{ inputs.endDrwtNo }}
rm -rf ~/num-deploy
24 changes: 21 additions & 3 deletions .github/workflows/store-batch.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: store-batch

on:
schedule:
- cron: '0 21 1 */6 *' # 6개월마다 1일 21시 (1/1, 7/1)
- cron: '0 20 1 */6 *' # 6개월마다 1일 21시 (1/1, 7/1)

jobs:
store-batch:
Expand All @@ -22,5 +22,23 @@ jobs:
- name: Build Gradle
run: ./gradlew clean --stacktrace --build-file=./batch/build.gradle.kts --exclude-task test build

- name: Job Execute
run: java -Dspring.profiles.active=prod -jar ./batch/build/libs/batch-0.0.1-SNAPSHOT.jar --spring.batch.job.names=lottoStoreJob
- name: Upload JAR To Instance
uses: appleboy/scp-action@master
with:
host: ${{ secrets.REMOTE_SSH_HOST }}
username: ${{ secrets.REMOTE_SSH_USERNAME }}
key: ${{ secrets.REMOTE_SSH_KEY }}
source: "./batch/build/libs/batch-0.0.1-SNAPSHOT.jar"
target: "/home/opc/store-deploy"

- name: Execute Job with Remote SSH
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.REMOTE_SSH_HOST }}
username: ${{ secrets.REMOTE_SSH_USERNAME }}
key: ${{ secrets.REMOTE_SSH_KEY }}
script: |
echo jobName=lottoStoreJob
ls ~/store-deploy/batch/build/libs -all
java -Dspring.profiles.active=prod -jar ~/store-deploy/batch/build/libs/batch-0.0.1-SNAPSHOT.jar --job.name=lottoStoreJob
rm -rf ~/store-deploy

0 comments on commit 026c790

Please sign in to comment.