Skip to content

[FIX,STYLE]: deprecated된 메소드 수정 및 구글 코드 스타일 적용 (#158) #99

[FIX,STYLE]: deprecated된 메소드 수정 및 구글 코드 스타일 적용 (#158)

[FIX,STYLE]: deprecated된 메소드 수정 및 구글 코드 스타일 적용 (#158) #99

Workflow file for this run

name: TogetUp-Server-Dev CI/CD
on:
push:
branches: [ "main" ]
env:
S3_BUCKET_NAME: togetup-storage
FILE_PATH: /home/ubuntu/app/
FILE_NAME: TogetUp-0.0.1-SNAPSHOT.jar
jobs:
deploy_dev:
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v3
- name: Set up JDK 11
uses: actions/setup-java@v3
with:
java-version: '11'
distribution: 'temurin'
- name: Get CurrentTime
uses: 1466587594/get-current-time@v2
id: current-time
with:
format: YYYY-MM-DDTHH-mm-ss
utcOffset: "+09:00"
- name: Show Current Time
run: echo "CurrentTime=${{steps.current-time.outputs.formattedTime}}"
shell: bash
- name: make application.yml
run: |
## create application.yml
mkdir -p ./src/main/resources
cd ./src/main/resources
touch ./application.yml
echo '${{ secrets.TOGETUP_DEV_APPLICATION }}' >> ./application.yml
cat ./application.yml
shell: bash
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean build
- name: Deliver File
uses: appleboy/scp-action@master
with:
host: ${{ secrets.EC2_HOST_DEV }}
username: ${{ secrets.EC2_USERNAME_DEV }}
key: ${{ secrets.EC2_SSH_KEY_DEV }}
port: 22
source: "build/libs/TogetUp-0.0.1-SNAPSHOT.jar"
target: "/home/ubuntu/app"
strip_components: 2
overwrite: true
- name: Deploy
uses: appleboy/ssh-action@master
with:
host: ${{ secrets.EC2_HOST_DEV }}
username: ${{ secrets.EC2_USERNAME_DEV }}
key: ${{ secrets.EC2_SSH_KEY_DEV }}
port: 22
wait_for_deployment: false
script: |
SOURCE_DIR=/home/ubuntu/app/
FILE_NAME=TogetUp-0.0.1-SNAPSHOT.jar
PID=$(ps aux | grep $FILE_NAME | grep -v grep | awk '{print $2}')
echo "PID : $PID"
if [ -z "$PID" ]; then
echo "#### THERE IS NO PROCESS ####"
else
echo "#### KILL $PID ####"
sudo kill $PID
fi
echo "#### RUNNING $SOURCE_DIR/$FILE_NAME ####"
cd $SOURCE_DIR
sudo nohup java -jar $FILE_NAME > nohup.out 2> nohup.err < /dev/null &
sleep 5
echo "New PID after restart: $(ps aux | grep $FILE_NAME | grep -v grep | awk '{print $2}')"