Fix: deploy.yml 중복 스텝 제거 #55
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| name: Java CI/CD - Test Server (Port 8081) | |
| on: | |
| push: | |
| branches: [ "feature/apple-login-split" ] # 이 브랜치에 푸시할 때만 작동 | |
| paths-ignore: | |
| - 'README.md' | |
| jobs: | |
| build-and-deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 17 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '17' | |
| distribution: 'temurin' | |
| - name: Grant execute permission for gradlew | |
| run: chmod +x gradlew | |
| - name: Create Firebase Key File | |
| run: | | |
| mkdir -p src/main/resources/firebase | |
| echo "${{ secrets.FIREBASE_KEY_JSON }}" > src/main/resources/firebase/monit-934c1-firebase-adminsdk-fbsvc-e4f3348b8c.json | |
| - name: Build with Gradle | |
| run: ./gradlew clean build -x test | |
| - name: Copy JAR to EC2 | |
| uses: appleboy/scp-action@v0.1.7 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USER }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| source: "build/libs/NITROGEN-0.0.1-SNAPSHOT.jar" | |
| target: "~/app/Nitrogen_Server/test" | |
| strip_components: 2 | |
| - name: Execute Remote SSH Commands | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USER }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script: | | |
| cd ~/app/Nitrogen_Server/test | |
| sudo fuser -k 8081/tcp || true | |
| find . -name "*-plain.jar" -delete | |
| nohup java -Xms128M -Xmx512M -jar NITROGEN-0.0.1-SNAPSHOT.jar \ | |
| --spring.config.location=file:./application-test.yml \ | |
| --server.port=8081 \ | |
| > test_nohup.out 2>&1 & |