Dev > Main 브랜치 병합 #173
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
| # This workflow uses actions that are not certified by GitHub. | |
| # They are provided by a third-party and are governed by | |
| # separate terms of service, privacy policy, and support | |
| # documentation. | |
| # This workflow will build a Java project with Gradle and cache/restore any dependencies to improve the workflow execution time | |
| # For more information see: https://docs.github.com/en/actions/automating-builds-and-tests/building-and-testing-java-with-gradle | |
| name: Java CD with Gradle | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| jobs: | |
| deploy: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/[email protected] | |
| - name: execute remote ssh & deploy backend server | |
| uses: appleboy/ssh-action@master | |
| with: | |
| host: ${{ secrets.REMOTE_SSH_HOST }} | |
| username: ${{ secrets.REMOTE_SSH_USERNAME }} | |
| key: ${{ secrets.REMOTE_SSH_KEY }} | |
| port: ${{ secrets.REMOTE_SSH_PORT }} | |
| script: | | |
| cd /home/ec2-user/backend/ | |
| git pull origin main | |
| chmod +x ./gradlew | |
| ./gradlew build | |
| docker compose down --remove-orphans || true | |
| docker compose up -d --build |