Merge pull request #82 from NameOfTeam/features/submit-cursor-nullable #192
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: Deploy to Server | |
| on: | |
| push: | |
| branches: [ "main" ] | |
| workflow_dispatch: | |
| permissions: | |
| contents: read | |
| jobs: | |
| build: | |
| runs-on: ubuntu-latest | |
| steps: | |
| - uses: actions/checkout@v4 | |
| - name: Setup JDK 21 | |
| uses: actions/setup-java@v4 | |
| with: | |
| java-version: '21' | |
| distribution: 'temurin' | |
| - name: Gradle Caching | |
| uses: actions/cache@v4 | |
| with: | |
| path: | | |
| ~/.gradle/caches | |
| ~/.gradle/wrapper | |
| key: ${{ runner.os }}-gradle-${{ hashFiles('**/*.gradle*', '**/gradle-wrapper.properties') }} | |
| restore-keys: | | |
| ${{ runner.os }}-gradle- | |
| - name: Build with Gradle | |
| run: | | |
| chmod +x ./gradlew | |
| ./gradlew clean bootJar -x test | |
| - name: Docker build & push | |
| run: | | |
| docker login -u ${{ secrets.DOCKER_USERNAME }} -p ${{ secrets.DOCKER_PASSWORD }} | |
| docker build -f Dockerfile -t ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }} . | |
| docker push ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }} | |
| - name: Deploy & Run | |
| uses: appleboy/ssh-action@master | |
| id: deploy | |
| with: | |
| host: ${{ secrets.SSH_HOST }} | |
| username: ${{ secrets.SSH_USERNAME }} | |
| key: ${{ secrets.SSH_KEY }} | |
| port: ${{ secrets.SSH_PORT }} | |
| envs: GITHUB_SHA | |
| script: | | |
| docker rm -f $(docker ps -qa) | |
| docker pull ${{ secrets.DOCKER_USERNAME }}/${{ secrets.DOCKER_REPOSITORY }} | |
| docker compose up -d | |
| docker image prune -f | |
| - name: CI Success Notification | |
| uses: sarisia/actions-status-discord@v1 | |
| if: ${{ success() }} | |
| with: | |
| title: CI | |
| webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
| color: 00FF00 | |
| - name: CI Failure Notification | |
| uses: sarisia/actions-status-discord@v1 | |
| if: ${{ failure() }} | |
| with: | |
| title: CI | |
| webhook: ${{ secrets.DISCORD_WEBHOOK }} | |
| color: FF0000 |