Skip to content

Commit

Permalink
fix: add ssh script to run springboot app & add comments
Browse files Browse the repository at this point in the history
  • Loading branch information
thisisWooyeol committed Nov 20, 2023
1 parent 1268060 commit a8ee8af
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions .github/workflows/springboot-on-push.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -25,13 +25,15 @@ jobs:
distribution: 'temurin'
cache: gradle

# Build & Test
- name: Grant execute permission for gradlew
run: chmod +x gradlew
- name: Build with Gradle
run: ./gradlew clean build
- name: Test with Gradle
run: ./gradlew test

# Deploy
- name: Set up SSH
uses: webfactory/[email protected]
with:
Expand All @@ -43,6 +45,10 @@ jobs:
working-directory: ./springboot/build/libs
- name: Execute remote commands
run: |
ssh ${{ secrets.SPRINGBOOT_USERNAME }}@${{ secrets.SPRINGBOOT_HOST_DNS }}\
"fuser -k 8080/tcp"
ssh ${{ secrets.SPRINGBOOT_USERNAME }}@${{ secrets.SPRINGBOOT_HOST_DNS }}\
ssh -v ${{ secrets.SPRINGBOOT_USERNAME }}@${{ secrets.SPRINGBOOT_HOST_DNS }}\
"cd ${{ secrets.SPRINGBOOT_TARGET_DIR }}"
ssh -v ${{ secrets.SPRINGBOOT_USERNAME }}@${{ secrets.SPRINGBOOT_HOST_DNS }}\
"fuser -k 8080/tcp || true"
ssh -v ${{ secrets.SPRINGBOOT_USERNAME }}@${{ secrets.SPRINGBOOT_HOST_DNS }}\
"sudo nohup /usr/bin/java -jar ${{ secrets.SPRINGBOOT_TARGET_DIR }}/build/libs/*.jar\
> {{ secrets.SPRINGBOOT_TARGET_DIR }}/app.log 2>&1 &"

0 comments on commit a8ee8af

Please sign in to comment.