File tree Expand file tree Collapse file tree 1 file changed +22
-4
lines changed
Expand file tree Collapse file tree 1 file changed +22
-4
lines changed Original file line number Diff line number Diff line change 66 - main # main 브랜치 push 시 자동 배포
77
88jobs :
9- deploy :
10- name : Deploy to EC2 Server
9+ build-and- deploy :
10+ name : Build and Deploy to EC2 Server
1111 runs-on : ubuntu-latest
1212
1313 steps :
1414 - name : Checkout code
1515 uses : actions/checkout@v4
1616
17+ - name : Set up JDK 17
18+ uses : actions/setup-java@v4
19+ with :
20+ java-version : ' 17'
21+ distribution : ' temurin'
22+
23+ - name : Grant execute permission for gradlew
24+ run : chmod +x ./gradlew
25+
26+ - name : Build with Gradle
27+ run : ./gradlew build -x test
28+
1729 - name : Set up SSH key
1830 run : |
1931 mkdir -p ~/.ssh
2032 echo "${{ secrets.EC2_KEY }}" > ~/.ssh/id_rsa
2133 chmod 600 ~/.ssh/id_rsa
2234 ssh-keyscan -H ${{ secrets.EC2_HOST }} >> ~/.ssh/known_hosts
2335
24- - name : SSH and deploy
36+ - name : Securely copy JAR file to EC2
37+ run : |
38+ scp -i ~/.ssh/id_rsa -o StrictHostKeyChecking=no \
39+ ./build/libs/Debug_Visual-0.0.1-SNAPSHOT.jar \
40+ ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }}:"/home/ec2-user/Zivorp Backend/Debug_Visual-0.0.1-SNAPSHOT.jar"
41+
42+ - name : SSH and run deploy script
2543 run : |
26- ssh ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "cd ~ && ./deploy.sh"
44+ ssh ${{ secrets.EC2_USER }}@${{ secrets.EC2_HOST }} "cd ~ && ./deploy.sh"
You can’t perform that action at this time.
0 commit comments