-
Notifications
You must be signed in to change notification settings - Fork 1
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
7 additions
and
33 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 |
---|---|---|
|
@@ -31,9 +31,8 @@ jobs: | |
|
||
- name: Build Jar | ||
run: | | ||
chmod 755 gradlew | ||
./gradlew bootJar | ||
working-directory: JWT | ||
chmod 755 JWT/gradlew | ||
JWT/gradlew bootJar | ||
- name: Prepare SSH connect | ||
env: | ||
|
@@ -43,50 +42,25 @@ jobs: | |
chmod 400 private_key.pem | ||
mkdir ~/.ssh | ||
ssh-keyscan -t rsa $host > ~/.ssh/known_hosts | ||
working-directory: JWT | ||
- name: Upload deployment scripts | ||
run: | | ||
scp -i private_key.pem -r deploy "${username}@${host}:~" | ||
working-directory: JWT | ||
sudo chmod 755 JWT/deploy/* | ||
scp -i private_key.pem -r JWT/deploy "${username}@${host}:~" | ||
- name: Kill current running Spring process | ||
uses: fifsky/[email protected] | ||
with: | ||
command: | | ||
sudo chmod 755 deploy/* | ||
deploy/shutdown.sh | ||
deploy/backup.sh | ||
host: ${{ secrets.EC2_HOST }} | ||
user: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
run: ssh -i private_key.pem "${username}@${host}" "deploy/shutdown.sh; deploy/backup.sh" | ||
|
||
- name: Send jar file to EC2 | ||
run: | | ||
jarPath=$(./gradlew -q jarPath) | ||
scp -i private_key.pem $jarPath "${username}@${host}:~/server.jar" | ||
working-directory: JWT | ||
- name: Startup new uploaded jar | ||
uses: fifsky/[email protected] | ||
with: | ||
command: | | ||
sudo chmod 755 deploy/* | ||
deploy/startup.sh | ||
host: ${{ secrets.EC2_HOST }} | ||
user: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
run: ssh -i private_key.pem "${username}@${host}" "deploy/startup.sh" | ||
|
||
- name: Wait 30 seconds for server to startup | ||
run: sleep 30 | ||
|
||
- name: Check and Recover | ||
uses: fifsky/[email protected] | ||
with: | ||
command: | | ||
sudo chmod 755 deploy/* | ||
deploy/check_and_recover.sh | ||
host: ${{ secrets.EC2_HOST }} | ||
user: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
|
||
run: ssh -i private_key.pem "${username}@${host}" "deploy/check_and_recover.sh" |