-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
2 changed files
with
108 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,7 +1,10 @@ | ||
name: CI | ||
name: ci | ||
|
||
on: | ||
push: | ||
paths: | ||
- 'api/**' | ||
- 'batch/**' | ||
tags: | ||
- 'v**' | ||
|
||
|
@@ -12,7 +15,7 @@ jobs: | |
ci: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: git checkout | ||
- name: Git Checkout | ||
uses: actions/checkout@v2 | ||
|
||
- name: Setup JDK | ||
|
@@ -23,22 +26,79 @@ jobs: | |
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: docker login | ||
- name: Dockerhub Login | ||
uses: docker/login-action@v2 | ||
with: | ||
username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
|
||
- name: Build Gradle with JIB | ||
- name: Set Path Filter (api, batch) | ||
uses: dorny/[email protected] | ||
id: changes | ||
with: | ||
filters: | | ||
api: | ||
- 'api/**' | ||
batch: | ||
- 'batch/**' | ||
# API build&deploy | ||
- name: Build Gradle with JIB (API) | ||
if: steps.changes.outputs.api == 'true' | ||
run: ./gradlew clean --stacktrace -PtagName=$GITHUB_REF_NAME --build-file=./api/build.gradle.kts -Djib.console=plain -Djib.useOnlyProjectCache=true jib | ||
|
||
- name: execute remote ssh | ||
- name: Execute Remote SSH & Deploy 'API' module | ||
if: steps.changes.outputs.api == 'true' | ||
uses: appleboy/ssh-action@master | ||
with: | ||
host: ${{ secrets.REMOTE_SSH_HOST }} | ||
username: ${{ secrets.REMOTE_SSH_USERNAME }} | ||
key: ${{ secrets.REMOTE_SSH_KEY }} | ||
# passphrase: ${{ secrets.REMOTE_SSH_PASSPHRASE }} | ||
# port: ${{ secrets.REMOTE_SSH_PORT }} | ||
# passphrase: ${{ secrets.REMOTE_SSH_PASSPHRASE }} | ||
# port: ${{ secrets.REMOTE_SSH_PORT }} | ||
script: | | ||
whoami | ||
whoami | ||
docker pull johnpark0921/lotto-portfolio:$GITHUB_REF_NAME | ||
docker container run --name lotto-portfolio -p 8080:8080 johnpark0921/lotto-portfolio:$GITHUB_REF_NAME | ||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
|
||
# 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: Dockerhub Login | ||
# uses: docker/login-action@v2 | ||
# with: | ||
# username: ${{ secrets.DOCKERHUB_USERNAME }} | ||
# password: ${{ secrets.DOCKERHUB_TOKEN }} | ||
# | ||
# - name: Build Gradle with JIB | ||
# run: ./gradlew clean --stacktrace -PtagName=$GITHUB_REF_NAME --build-file=./api/build.gradle.kts -Djib.console=plain -Djib.useOnlyProjectCache=true jib | ||
# | ||
# - name: execute remote ssh | ||
# uses: appleboy/ssh-action@master | ||
# with: | ||
# host: ${{ secrets.REMOTE_SSH_HOST }} | ||
# username: ${{ secrets.REMOTE_SSH_USERNAME }} | ||
# key: ${{ secrets.REMOTE_SSH_KEY }} | ||
## passphrase: ${{ secrets.REMOTE_SSH_PASSPHRASE }} | ||
## port: ${{ secrets.REMOTE_SSH_PORT }} | ||
# script: | | ||
# whoami |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
#name: cd | ||
# | ||
#on: | ||
# push: | ||
# paths: | ||
# - 'api/**' | ||
# - 'batch/**' | ||
# tags: | ||
# - 'v**' | ||
# | ||
#jobs: | ||
# cd: | ||
# runs-on: ubuntu-latest | ||
# steps: | ||
# - name: git checkout | ||
# uses: actions/checkout@v2 | ||
# | ||
# - name: Set Path Filter (api, batch) | ||
# uses: dorny/[email protected] | ||
# id: changes | ||
# with: | ||
# filters: | | ||
# api: | ||
# - 'api/**' | ||
# batch: | ||
# - 'batch/**' | ||
# | ||
# - name: Execute Remote SSH & Deploy 'API' module | ||
# if: steps.changes.outputs.back == 'true' | ||
# uses: appleboy/ssh-action@master | ||
# with: | ||
# host: ${{ secrets.REMOTE_SSH_HOST }} | ||
# username: ${{ secrets.REMOTE_SSH_USERNAME }} | ||
# key: ${{ secrets.REMOTE_SSH_KEY }} | ||
# script: | | ||
# whoami | ||
# docker pull johnpark0921/lotto-portfolio:$GITHUB_REF_NAME | ||
# docker container run --name lotto-portfolio -p 8080:8080 johnpark0921/lotto-portfolio:$GITHUB_REF_NAME | ||
# | ||
# # TODO: batch deploy문도 작성 필요 (crontab 설정 넣기) |