Some checks failed
Build and Push Docker Images / verify-docs-sync (push) Successful in 8s
Build and Push Docker Images / build-backend (push) Successful in 14s
Build and Push Docker Images / build-frontend (push) Successful in 14s
Build and Push Docker Images / build-docs (push) Failing after 20s
138 lines
4.4 KiB
YAML
138 lines
4.4 KiB
YAML
name: Build and Push Docker Images
|
|
run-name: Build Backend, Frontend & Docs by @${{ github.actor }}
|
|
|
|
on: [push]
|
|
|
|
env:
|
|
# Passe dies an deine Registry an.
|
|
# Wenn du die Gitea-interne Registry nutzt, ist es meist einfach der Hostname deiner Gitea-Instanz.
|
|
# Beispiel: gitea.deine-domain.de
|
|
REGISTRY_HOST: git.federspiel.tech
|
|
# Der Name des Repos (z.B. user/repo).
|
|
# Explizit in lowercase gesetzt, damit es exakt zu den Compose-Imagepfaden passt.
|
|
IMAGE_NAME: flfeders/fedeo
|
|
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
|
|
uses: actions/checkout@v3
|
|
|
|
- name: Log in to Docker Registry
|
|
uses: docker/login-action@v2
|
|
with:
|
|
registry: ${{ env.REGISTRY_HOST }}
|
|
# Gitea stellt secrets.GITHUB_TOKEN automatisch bereit (wie GitLab CI_JOB_TOKEN)
|
|
username: ${{ env.ACTOR }}
|
|
password: ${{ vars.CI_TOKEN }}
|
|
|
|
- name: Extract metadata (tags, labels) for Backend
|
|
id: meta-backend
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: ${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}/backend
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=tag
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
|
|
- name: Build and push Backend
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: ./backend # Hier wird der Ordner gewechselt (wie 'cd backend')
|
|
push: true
|
|
tags: ${{ steps.meta-backend.outputs.tags }}
|
|
labels: ${{ steps.meta-backend.outputs.labels }}
|
|
|
|
build-frontend:
|
|
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 Frontend
|
|
id: meta-frontend
|
|
uses: docker/metadata-action@v4
|
|
with:
|
|
images: ${{ env.REGISTRY_HOST }}/${{ env.IMAGE_NAME }}/frontend
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=ref,event=tag
|
|
type=raw,value=latest,enable=${{ github.ref == 'refs/heads/main' }}
|
|
|
|
- name: Build and push Frontend
|
|
uses: docker/build-push-action@v4
|
|
with:
|
|
context: ./frontend # Hier wird der Ordner gewechselt (wie 'cd frontend')
|
|
push: true
|
|
tags: ${{ steps.meta-frontend.outputs.tags }}
|
|
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 }}
|