diff --git a/.gitea/workflows/build-push.yaml b/.gitea/workflows/build-push.yaml index 937711f..0a288cb 100644 --- a/.gitea/workflows/build-push.yaml +++ b/.gitea/workflows/build-push.yaml @@ -1,5 +1,5 @@ name: Build and Push Docker Images -run-name: Build Backend & Frontend by @${{ github.actor }} +run-name: Build Backend, Frontend & Docs by @${{ github.actor }} on: [push] @@ -13,7 +13,32 @@ env: ACTOR: flfeders jobs: + verify-docs-sync: + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Prüfe Node-Version + uses: actions/setup-node@v4 + with: + node-version: 20 + + - name: Synchronisiere Funktionsdokumentation + run: node docs/scripts/sync-funktionsdoku.mjs + + - name: Breche ab, wenn Doku nicht aktuell committed ist + run: | + if [ -n "$(git status --porcelain docs/)" ]; then + echo "Die generierte Dokumentation ist nicht aktuell." + echo "Bitte lokal ausführen: node docs/scripts/sync-funktionsdoku.mjs" + echo "Danach die Änderungen committen." + git status --short docs/ + exit 1 + fi + build-backend: + needs: verify-docs-sync runs-on: ubuntu-latest steps: - name: Check out repository code @@ -46,6 +71,7 @@ jobs: labels: ${{ steps.meta-backend.outputs.labels }} build-frontend: + needs: verify-docs-sync runs-on: ubuntu-latest steps: - name: Check out repository code @@ -74,4 +100,37 @@ jobs: context: ./frontend # Hier wird der Ordner gewechselt (wie 'cd frontend') push: true tags: ${{ steps.meta-frontend.outputs.tags }} - labels: ${{ steps.meta-frontend.outputs.labels }} \ No newline at end of file + labels: ${{ steps.meta-frontend.outputs.labels }} + + build-docs: + needs: verify-docs-sync + runs-on: ubuntu-latest + steps: + - name: Check out repository code + uses: actions/checkout@v3 + + - name: Log in to Docker Registry + uses: docker/login-action@v2 + with: + registry: ${{ env.REGISTRY_HOST }} + username: ${{ env.ACTOR }} + password: ${{ vars.CI_TOKEN }} + + - name: Extract metadata (tags, labels) for Docs + id: meta-docs + uses: docker/metadata-action@v4 + with: + images: ${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}/docs + tags: | + type=ref,event=branch + type=ref,event=tag + type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }} + + - name: Build and push Docs + uses: docker/build-push-action@v4 + with: + context: . + file: ./docs-site/Dockerfile + push: true + tags: ${{ steps.meta-docs.outputs.tags }} + labels: ${{ steps.meta-docs.outputs.labels }}