-
Notifications
You must be signed in to change notification settings - Fork 3
33 lines (31 loc) · 1019 Bytes
/
deploy.yaml
File metadata and controls
33 lines (31 loc) · 1019 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
name: Deploy to EC2
on:
# schedule:
# - cron: '0 0 * * *'
pull_request_target:
types: [closed]
branches:
- main
jobs:
Deploy:
if: github.event.pull_request.merged == true
runs-on: ubuntu-latest
steps:
- name: SSH로 EC2 원격 접속하기
uses: appleboy/ssh-action@v1.0.3
env:
APPLICATION_PROPERTIES: ${{ secrets.APPLICATION_PROPERTIES }}
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
envs: APPLICATION_PROPERTIES
script_stop: true
script: |
cd /home/ubuntu/backend
rm -rf src/main/resources/application.yaml
git pull origin main --rebase
echo "$APPLICATION_PROPERTIES" > src/main/resources/application.yaml
./gradlew clean build -x test
sudo fuser -k -n tcp 8080 || true
nohup java -jar build/libs/*SNAPSHOT.jar > ./output.log 2>&1 &