Skip to content

Commit

Permalink
Update auto-deployment.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
wwingyou authored Mar 25, 2024
1 parent 40a7fd0 commit 1003d1b
Showing 1 changed file with 10 additions and 26 deletions.
36 changes: 10 additions & 26 deletions .github/workflows/auto-deployment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,9 @@ jobs:
- name: Setup Java JDK
uses: actions/[email protected]
with:
# The Java version to set up. Takes a whole or semver Java version. See examples of supported syntax in README file
java-version: 17
# Java distribution. See the list of supported distributions in README file
distribution: temurin
# The package type (jdk, jre, jdk+fx, jre+fx)
java-package: jdk
# The architecture of the package (defaults to the action runner's architecture)
architecture: x64
cache: gradle

Expand All @@ -56,41 +52,29 @@ jobs:
scp -i private_key.pem -r deploy "${username}@${host}:~"
working-directory: JWT

- name: Remote SSH Commands
- name: Kill current running Spring process
uses: fifsky/[email protected]
with:
command: |
echo $JAVA_HOME
echo $PATH
java --version
sudo chmod 755 deploy/*
deploy/shutdown.sh
deploy/backup.sh
host: ${{ secrets.EC2_HOST }}
user: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}

- name: Kill current running Spring process
uses: appleboy/[email protected]
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
script: |
echo $JAVA_HOME
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
uses: appleboy/ssh-action@v1.0.3
uses: fifsky/ssh-action@v0.0.6
with:
host: ${{ secrets.EC2_HOST }}
username: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}
script: |
command: |
sudo chmod 755 deploy/*
deploy/startup.sh
host: ${{ secrets.EC2_HOST }}
user: ${{ secrets.EC2_USERNAME }}
key: ${{ secrets.EC2_PRIVATE_KEY }}

0 comments on commit 1003d1b

Please sign in to comment.