Skip to content

Commit

Permalink
Update gradle.yml
Browse files Browse the repository at this point in the history
  • Loading branch information
yooooonshine authored Jan 17, 2025
1 parent de3485b commit 288ee9a
Showing 1 changed file with 7 additions and 11 deletions.
18 changes: 7 additions & 11 deletions .github/workflows/gradle.yml
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

name: Java CI with Gradle

on:
Expand Down Expand Up @@ -39,29 +38,26 @@ jobs:
run: cd backend/ && ./gradlew build

- name: Upload build artifact
uses: actions/upload-artifact@v2
uses: actions/upload-artifact@v3
with:
name: backend
path: ./backend/build/libs/backend-0.0.1-SNAPSHOT.jar

# 배포 **
deploy:
needs: build
runs-on: ubuntu-latest

steps:
- name: Download build artifact
uses: actions/download-artifact@v2
uses: actions/download-artifact@v3
with:
name: backend
path: ./backend/build/libs/

- name: Deploy to EC2
run: |
echo "${{ secrets.EC2_SSH_KEY }}" > middle-point-search.pem
chmod 600 middle-point-search.pem
scp -i middle-point-search.pem -o StrictHostKeyChecking=no ./backend/build/libs/backend-0.0.1-SNAPSHOT.jar ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_HOST }}:/home/${{ secrets.EC2_USERNAME }}/backend-0.0.1-SNAPSHOT.jar
ssh -i middle-point-search.pem -o StrictHostKeyChecking=no ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_HOST }} "pgrep java | xargs kill -9; nohup java -jar /home/${{ secrets.EC2_USERNAME }}/backend-0.0.1-SNAPSHOT.jar &"
rm -f middle_point.pem
echo "${{ secrets.EC2_SSH_KEY }}" > sync_spot_dev.pem
chmod 600 sync_spot_dev.pem
scp -i sync_spot_dev.pem -o StrictHostKeyChecking=no ./backend/build/libs/backend-0.0.1-SNAPSHOT.jar ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_HOST }}:/home/${{ secrets.EC2_USERNAME }}/backend-0.0.1-SNAPSHOT.jar
ssh -i sync_spot_dev.pem -o StrictHostKeyChecking=no ${{ secrets.EC2_USERNAME }}@${{ secrets.EC2_HOST }} "pgrep java | xargs kill -9; nohup java -jar /home/${{ secrets.EC2_USERNAME }}/backend-0.0.1-SNAPSHOT.jar &"
rm -f sync_spot_dev.pem

0 comments on commit 288ee9a

Please sign in to comment.