name: Build and Deploy Spring Boot Server on: push: branches: - dev jobs: build: runs-on: ubuntu-latest steps: # 1. Checkout the code - name: Checkout code uses: actions/checkout@v4 # 2. Set up Java (Maven wrapper handles Maven version automatically) - name: Set up JDK (Eclipse Temurin) uses: actions/setup-java@v4 with: distribution: "temurin" java-version: "17" cache: maven # 3. Build the Spring Boot application using the Maven wrapper - name: Build Spring Boot Application run: ./mvnw clean package -DskipTests # 4. Set up Docker Buildx (enables layer caching) - name: Set up Docker Buildx uses: docker/setup-buildx-action@v3 # 5. Docker login - name: Login to Docker Registry uses: docker/login-action@v3 with: registry: tea.zendric.de username: ${{ secrets.TEAUSER }} password: ${{ secrets.TEAPASSWORD }} # 6. Build and push Docker image with layer caching - name: Build and Push Docker Image uses: docker/build-push-action@v5 with: context: . push: true tags: tea.zendric.de/cedric/xpensely-server:latest cache-from: type=registry,ref=tea.zendric.de/cedric/xpensely-server:buildcache cache-to: type=registry,ref=tea.zendric.de/cedric/xpensely-server:buildcache,mode=max # 7. Trigger Dokploy to redeploy the dev server automatically - name: Trigger Dokploy Redeploy run: | curl -X POST "${{ secrets.DOKPLOY_WEBHOOK_URL }}" \ -H "Authorization: Bearer ${{ secrets.DOKPLOY_TOKEN }}" \ --fail