-
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
1 changed file
with
24 additions
and
68 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,90 +1,46 @@ | ||
name: leets-actions | ||
run-name: Running | ||
name: mouda-dev | ||
|
||
on: | ||
push: | ||
branches: | ||
- dev | ||
- 'releases/**' | ||
|
||
env: | ||
APPLICATION: ${{ secrets.APPLICATION }} | ||
WORKING_DIRECTORY: ./ | ||
|
||
jobs: | ||
build-with-gradle: | ||
runs-on: ubuntu-20.04 | ||
build: | ||
runs-on: ubuntu-24.04 | ||
|
||
steps: | ||
- uses: actions/checkout@v3 | ||
- name: 레포지토리 체크아웃 | ||
uses: actions/checkout@v4 | ||
|
||
- name: JDK 17 설치 | ||
uses: actions/setup-java@v3 | ||
- name: JDK 17을 설치 | ||
uses: actions/setup-java@v4 | ||
with: | ||
java-version: '17' | ||
distribution: 'corretto' | ||
|
||
- name: 환경변수 설정 | ||
run: | | ||
echo "${{env.APPLICATION}}" > ./src/main/resources/application.yml | ||
- name: gradlew에 실행 권한 부여 | ||
- name: gradlew 권한 부여 | ||
run: chmod +x gradlew | ||
working-directory: ${{ env.WORKING_DIRECTORY }} | ||
|
||
- name: 프로젝트 빌드 | ||
run: ./gradlew clean build -x test | ||
- name: Gradle 빌드 | ||
run: ./gradlew build | ||
|
||
deploy: | ||
needs: build | ||
runs-on: self-hosted | ||
steps: | ||
- name: change permission | ||
run: | | ||
sudo chown -R ubuntu:ubuntu /home/ubuntu/actions-runner/_work/jwp-shopping-order | ||
- name: kill 8080 port if exist | ||
run: | | ||
CURRENT_PID=$(pgrep -f ${PROJECT_NAME}.*.jar) | ||
if [ -z "$CURRENT_PID" ]; then | ||
echo "> NONE\\n" | ||
else | ||
echo "> kill -9 ${CURRENT_PID}\\n" | ||
kill -9 $CURRENT_PID | ||
sleep 5 | ||
fi | ||
- name: DockerHub 로그인 | ||
uses: docker/login-action@v1 | ||
with: | ||
username: ${{ secrets.DOCKER_USERNAME_MOUDA }} | ||
password: ${{ secrets.DOCKER_PASSWORD_MOUDA }} | ||
|
||
# 스프링 프로그램을 실행합니다 | ||
- name: deploy | ||
- name: 도커 이미지 빌드 및 푸시 | ||
run: | | ||
echo "> Deploy New Project$\\n" | ||
JAR_NAME=$(ls -tr build/libs/*.jar | tail -n 1) | ||
echo "> jar Name : $JAR_NAME\\n" | ||
nohup java -jar $JAR_NAME & | ||
docker build -t 2024mouda/mouda-be:latest . | ||
docker push 2024mouda/mouda-be:latest | ||
# | ||
# - name: DockerHub 로그인 | ||
# uses: docker/login-action@v1 | ||
# with: | ||
# username: ${{ secrets.DOCKER_USERNAME }} | ||
# password: ${{ secrets.DOCKER_PASSWORD }} | ||
# | ||
# - name: 도커 이미지 빌드 및 푸시 | ||
# run: | | ||
# docker build -t ayeonii/leets-be:latest . | ||
# docker push ayeonii/leets-be:latest | ||
# | ||
# - name: 배포 | ||
# uses: appleboy/ssh-action@master | ||
# with: | ||
# host: ${{ secrets.REMOTE_IP }} | ||
# username: ${{ secrets.REMOTE_USER }} | ||
# key: ${{ secrets.REMOTE_IDENTITYFILE }} | ||
# port: ${{ secrets.REMOTE_PORT }} | ||
# script: | | ||
# cd server | ||
# docker compose -f docker-compose.yml down leets-be | ||
# docker compose -f docker-compose.yml pull leets-be | ||
# docker compose -f docker-compose.yml up -d leets-be | ||
- name: Docker Compose up | ||
run: | | ||
docker compose -f docker-compose.yml down mouda-be | ||
docker compose -f docker-compose.yml pull mouda-be | ||
docker compose -f docker-compose.yml up -d mouda-be |