Skip to content

Commit

Permalink
Merge branch 'develop' into feat/131-infra
Browse files Browse the repository at this point in the history
  • Loading branch information
beakgugong committed Nov 8, 2024
2 parents 6bf4fa4 + 3548843 commit 39c4fd7
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 1 deletion.
74 changes: 74 additions & 0 deletions .github/workflows/develop-cicd.yml
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
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ name: Java CI & CD with Gradle

on:
push:
branches: [ "develop" ]
branches: [ "main" ]
# pull_request:
# branches: [ "develop" ]

Expand Down

0 comments on commit 39c4fd7

Please sign in to comment.