Merge pull request #36 from doghae/Feat/issue#14 #61
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: Deploy To Ec2 | |
on: | |
push: | |
branches: | |
- main | |
jobs: | |
Deploy: | |
runs-on: ubuntu-latest | |
steps: | |
- name: SSH로 EC2에 접속하기 | |
uses: appleboy/[email protected] | |
env: | |
APPLICATION_PROD_PROPERTIES: ${{ secrets.APPLICATION_PROPERTIES }} | |
with: | |
host: ${{ secrets.EC2_HOST }} | |
username: ${{ secrets.EC2_USERNAME }} | |
key: ${{ secrets.EC2_PRIVATE_KEY }} | |
script-stop: true | |
script: | | |
cd /home/ubuntu/backend | |
rm -rf src/main/resources/application-prod.yml | |
git pull origin main | |
echo "${{ secrets.APPLICATION_PROD_PROPERTIES }}" > src/main/resources/application-prod.yml | |
cat src/main/resources/application-prod.yml | |
./gradlew clean build -x test -Pprofile=prod | |
sudo fuser -k -n tcp 8080 || true | |
nohup java -jar build/libs/*SNAPSHOT.jar > ./output.log 2>&1 & |