Merge pull request #54 from Kusitms-POPTATO-DEV/fix/histories-complet… #1
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
name: Java CD with Gradle - Dev | |
on: | |
push: | |
branches: [ "dev" ] | |
jobs: | |
deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: Connect to EC2 via SSH | |
uses: appleboy/ssh-action@master | |
env: | |
DEV_APPLICATION_YML: ${{ secrets.DEV_APPLICATION_YML }} | |
APPLICATION_TEST_YML: ${{ secrets.APPLICATION_TEST_YML }} | |
TEST_DATA_SQL: ${{ secrets.TEST_DATA_SQL }} | |
FIREBASE_ADMIN: ${{ secrets.FIREBASE_ADMIN }} | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.EC2_PRIVATE_KEY }} | |
script_stop: true | |
envs: DEV_APPLICATION_YML, APPLICATION_TEST_YML, TEST_DATA_SQL, FIREBASE_ADMIN | |
# git clone 같은 초기 작업은 ec2에서 먼저 진행 | |
script: | | |
cd /home/ubuntu/poptato_server/Poptato_Server_Dev | |
git switch dev | |
git pull origin dev | |
rm -rf src/main/resources/application.yml | |
mkdir -p src/main/resources | |
echo "$DEV_APPLICATION_YML" > src/main/resources/application.yml | |
rm -rf src/test/resources/application.yml | |
mkdir -p src/test/resources | |
echo "$APPLICATION_TEST_YML" > src/test/resources/application.yml | |
rm -rf src/test/resources/data.sql | |
echo "$TEST_DATA_SQL" > src/test/resources/data.sql | |
echo "$FIREBASE_ADMIN" > ildan-project-firebase-adminsdk-rcb58-766d3dd75f.json | |
chmod +x gradlew | |
./gradlew clean | |
./gradlew build | |
sudo fuser -k -n tcp "${{ secrets.DEV_SERVER_PORT }}" || true | |
nohup java -Duser.timezone=Asia/Seoul -jar build/libs/*SNAPSHOT.jar > ./output.log 2>&1 & | |