From 1003d1b5251285f532d4d32316939b285f32b871 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=EC=9D=B4=EC=8A=B9=EA=B7=9C?= <156777781+wwingyou@users.noreply.github.com> Date: Mon, 25 Mar 2024 17:12:51 +0900 Subject: [PATCH] Update auto-deployment.yml --- .github/workflows/auto-deployment.yml | 36 ++++++++------------------- 1 file changed, 10 insertions(+), 26 deletions(-) diff --git a/.github/workflows/auto-deployment.yml b/.github/workflows/auto-deployment.yml index 8a05114..f61f45b 100644 --- a/.github/workflows/auto-deployment.yml +++ b/.github/workflows/auto-deployment.yml @@ -25,13 +25,9 @@ jobs: - name: Setup Java JDK uses: actions/setup-java@v4.2.1 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 @@ -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/ssh-action@v0.0.6 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/ssh-action@v1.0.3 - 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 }}