Files
XpenselyServer/.gitea/workflows/build.yml
T
Cedric b42980200d
Build and Deploy Spring Boot Server / build (push) Failing after 1m48s
ci: trigger Dokploy redeploy via API after image push
2026-05-10 23:38:07 +02:00

58 lines
1.9 KiB
YAML

name: Build and Deploy Spring Boot Server
on:
push:
branches:
- dev
jobs:
build:
runs-on: ubuntu-java17
steps:
# 1. Checkout the code
- name: Checkout code
uses: actions/checkout@v4
# 2. Build the Spring Boot application using the Maven wrapper (Java 17 pre-installed in runner image)
- 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. Login to Docker Hub to avoid pull rate limits
- name: Login to Docker Hub
uses: docker/login-action@v3
with:
username: ${{ secrets.DOCKERHUB_USER }}
password: ${{ secrets.DOCKERHUB_TOKEN }}
# 6. Docker login to Gitea registry
- name: Login to Docker Registry
uses: docker/login-action@v3
with:
registry: tea.zendric.de
username: ${{ secrets.TEAUSER }}
password: ${{ secrets.TEAPASSWORD }}
# 7. 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
# 8. Trigger Dokploy to redeploy the dev server automatically via API
- name: Trigger Dokploy Redeploy
run: |
curl -X POST "https://dokploy.zendric.de/api/compose.redeploy" \
-H "Content-Type: application/json" \
-H "x-api-key: ${{ secrets.DOKPLOY_API_TOKEN }}" \
-d "{\"composeId\": \"${{ secrets.DOKPLOY_COMPOSE_ID }}\"}" \
--fail