-
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.
Merge branch 'develop' into feat/131-infra
- Loading branch information
Showing
2 changed files
with
75 additions
and
1 deletion.
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 |
---|---|---|
@@ -0,0 +1,74 @@ | ||
name: Java CI & CD with Gradle | ||
|
||
on: | ||
push: | ||
branches: | ||
- develop | ||
|
||
permissions: | ||
contents: read | ||
|
||
jobs: | ||
build: | ||
|
||
runs-on: ubuntu-latest | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: Set up JDK 17 | ||
uses: actions/setup-java@v3 | ||
with: | ||
java-version: '17' | ||
distribution: 'temurin' | ||
|
||
- name: application.yml 설정 | ||
run: | | ||
cd ./src/main | ||
mkdir resources | ||
cd ./resources | ||
touch ./application.yml | ||
echo "$APPLICATION_DEVELOP" > ./application.yml | ||
env: | ||
APPLICATION_DEVELOP: ${{ secrets.APPLICATION_DEVELOP }} | ||
|
||
- name: Gradle Caching | ||
uses: actions/cache@v3 | ||
with: | ||
path: | | ||
~/.gradle/caches | ||
~/.gradle/wrapper | ||
key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | ||
restore-keys: | | ||
${{ runner.os }}-gradle- | ||
|
||
# gradle build | ||
- name: Grant execute permission for gradlew | ||
run: chmod +x gradlew | ||
|
||
- name: Build with Gradle | ||
run: ./gradlew build -x test | ||
|
||
|
||
## 웹 이미지 빌드 및 도커허브에 push | ||
- name: web docker build and push | ||
run: | | ||
docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | ||
docker build -t ${{ secrets.DOCKER_REPO }}/ussum-develop:latest . | ||
docker push ${{ secrets.DOCKER_REPO }}/ussum-develop:latest | ||
## 도커 허브에서 jar파일 및 pull후에 컴포즈 up | ||
- name: Deploy to Dev | ||
uses: appleboy/ssh-action@master | ||
with: | ||
username: ubuntu | ||
host: ${{ secrets.DEVELOP_HOST }} | ||
key: ${{ secrets.DEVELOP_KEY }} | ||
script: | | ||
sudo docker stop ussum-develop || true | ||
sudo docker container prune -f | ||
sudo docker pull ${{ secrets.DOCKER_REPO }}/ussum-develop:latest | ||
sudo docker run -d --log-driver=syslog \ | ||
-e TZ=Asia/Seoul \ | ||
-p 8080:8080 --name ussum-develop \ | ||
${{ secrets.DOCKER_REPO }}/ussum-develop:latest |
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