-
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
25 additions
and
10 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 |
---|---|---|
|
@@ -18,8 +18,10 @@ jobs: | |
|
||
steps: | ||
- uses: actions/[email protected] | ||
|
||
- name: Show git status | ||
run: git status | ||
|
||
- name: Setup Java JDK | ||
uses: actions/[email protected] | ||
with: | ||
|
@@ -32,11 +34,13 @@ jobs: | |
# The architecture of the package (defaults to the action runner's architecture) | ||
architecture: x64 | ||
cache: gradle | ||
|
||
- name: Build Jar | ||
run: | | ||
chmod 755 gradlew | ||
./gradlew bootJar | ||
working-directory: JWT | ||
|
||
- name: Prepare SSH connect | ||
env: | ||
private_key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
|
@@ -46,24 +50,35 @@ jobs: | |
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}:~" | ||
sudo chmod 755 deploy/* | ||
working-directory: JWT | ||
|
||
- name: Kill current running Spring process | ||
run: | | ||
ssh -i private_key.pem "${username}@${host}" | ||
deploy/shutdown.sh | ||
deploy/backup.sh | ||
working-directory: JWT | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
script: | | ||
sudo chmod 755 deploy/* | ||
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: Run new uploaded jar | ||
run: | | ||
ssh -i private_key.pem "${username}@${host}" | ||
deploy/startup.sh | ||
working-directory: JWT | ||
uses: appleboy/[email protected] | ||
with: | ||
host: ${{ secrets.EC2_HOST }} | ||
username: ${{ secrets.EC2_USERNAME }} | ||
key: ${{ secrets.EC2_PRIVATE_KEY }} | ||
script: | | ||
sudo chmod 755 deploy/* | ||
deploy/startup.sh |