#151 [Breaking Change] Admin 도메인 이관 및 관리자 UI 동기화 (#155) #10
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 with Gradle (Dev Server) | |
| on: | |
| push: | |
| branches: [ "dev" ] | |
| workflow_dispatch: | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Set up JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| cache: 'gradle' | |
| - name: Build with Gradle | |
| run: | | |
| chmod +x ./gradlew | |
| ./gradlew build -x test | |
| # // 1. JAR 파일만 전송 준비 (환경변수는 서버에서 직접 생성하는게 더 깔끔해) | |
| - name: Prepare deployment files | |
| run: | | |
| mkdir -p deploy | |
| cp build/libs/*-SNAPSHOT.jar deploy/ | |
| # // 2. JAR 파일 EC2로 전송 | |
| - name: Copy files to EC2 | |
| uses: appleboy/scp-action@v0.1.7 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USERNAME }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| source: "deploy/*" | |
| target: "~/dev-server" | |
| strip_components: 1 | |
| # // 3. EC2 서버에서 실행 스크립트 | |
| - name: Deploy to EC2 | |
| uses: appleboy/ssh-action@v1.0.3 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USERNAME }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| script: | | |
| # 1. 기존 8081 프로세스 종료 | |
| fuser -k 8081/tcp || true | |
| cd ~/dev-server | |
| # 2. .env 파일 생성 | |
| cat <<'EOF' > .env | |
| ${{ secrets.ENV_VARIABLES }} | |
| EOF | |
| # 3. 환경 변수 로드 및 메모리 제한 걸어서 실행 | |
| # // 1. set -a로 .env 로드, -Xmx256m으로 메모리 방어 | |
| set -a; source .env; set +a | |
| nohup java -Xmx256m -Dserver.port=8081 -jar *-SNAPSHOT.jar > dev-app.log 2>&1 & |