Repository navigation
[Hotfix] HomeService stream NPE μμ (#74) #19
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 | |
| on: | |
| push: | |
| branches: [ "dev" ] # 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 | |
| - name: Create .env file from Secret | |
| run: | | |
| cat <<'EOF' > .env | |
| ${{ secrets.ENV_VARIABLES }} | |
| EOF | |
| - name: Copy JAR and .env to EC2 | |
| uses: appleboy/scp-action@v0.1.7 | |
| with: | |
| host: ${{ secrets.EC2_HOST }} | |
| username: ${{ secrets.EC2_USERNAME }} | |
| key: ${{ secrets.EC2_SSH_KEY }} | |
| # -plain.jarλ λ°°ν¬μ νμ μμΌλ―λ‘ μ μΈν©λλ€. | |
| source: "build/libs/*-SNAPSHOT.jar, .env" | |
| target: "~/" | |
| strip_components: 2 | |
| - 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: | | |
| fuser -k 8080/tcp || true | |
| chmod +x ~/start.sh | |
| ~/start.sh |