Skip to content

Commit

Permalink
change to pure ssh
Browse files Browse the repository at this point in the history
  • Loading branch information
marcelluethi committed Sep 24, 2024
1 parent df66e35 commit c18c2c0
Showing 1 changed file with 9 additions and 9 deletions.
18 changes: 9 additions & 9 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -50,19 +50,19 @@ jobs:
# Step 6: Deploy to the server
- name: Deploy to Server
if: success() # This step will only run if all previous steps are successful
uses: appleboy/[email protected]
with:
host: ${{ secrets.SERVER_IP }}
username: ${{ secrets.SSH_USER }}
key: ${{ secrets.SSH_PRIVATE_KEY }}
port: 22
script: |
run: |
ssh -i ~/.ssh/id_rsa -p 22 ${{ secrets.SSH_USER }}@${{ secrets.SERVER_IP }} << 'EOF'
# Navigate to the server directory and stop the old server (if running)
cd ${{ secrets.SERVER_PATH }} || echo "cannot change to directory"
touch "beforekill.txt"
# kill server if another one is running
# Kill server if another one is running
PID=$(pgrep -f 'java -jar CDDemo-1.0-SNAPSHOT.jar')
if [ -n "$PID" ]; then
kill $PID
fi
touch "afterkill.txt"
# Start the new server
nohup java -jar ${{ secrets.SERVER_PATH }}/CDDemo-1.0-SNAPSHOT.jar > output.log 2>&1 &
EOF

0 comments on commit c18c2c0

Please sign in to comment.