name: Images bauen # Bei Push auf main und bei Versions-Tags. Ausgerollt wird nicht automatisch – # das Aktualisieren auf docker-srv001 passiert von Hand, siehe docs/deployment.md. on: push: branches: - main tags: - "v*" concurrency: group: build-${{ github.ref }} cancel-in-progress: false env: REGISTRY: git.menzel.center NAMESPACE: menzeljonas jobs: build: runs-on: ubuntu-latest strategy: fail-fast: false matrix: component: - backend - frontend steps: - uses: actions/checkout@v4 - uses: docker/setup-buildx-action@v3 - name: An der Registry anmelden uses: docker/login-action@v3 with: registry: ${{ env.REGISTRY }} username: ${{ github.actor }} password: ${{ secrets.REGISTRY_TOKEN }} - name: Tags und Beschriftungen ermitteln id: meta uses: docker/metadata-action@v5 with: images: ${{ env.REGISTRY }}/${{ env.NAMESPACE }}/moneyfy-${{ matrix.component }} # `latest` wird nur für Versions-Tags gesetzt, nicht für jeden main-Push. flavor: | latest=false tags: | type=raw,value=main,enable=${{ github.ref == 'refs/heads/main' }} type=sha,prefix=sha-,format=short,enable=${{ github.ref == 'refs/heads/main' }} type=semver,pattern={{version}} type=semver,pattern={{major}}.{{minor}} type=raw,value=latest,enable=${{ startsWith(github.ref, 'refs/tags/v') }} labels: | org.opencontainers.image.title=moneyfy-${{ matrix.component }} org.opencontainers.image.description=moneyfy – Planung monatlicher Kosten und Einkünfte org.opencontainers.image.licenses=MIT - name: Bauen und hochladen uses: docker/build-push-action@v6 with: context: ./${{ matrix.component }} target: production platforms: linux/amd64 push: true tags: ${{ steps.meta.outputs.tags }} labels: ${{ steps.meta.outputs.labels }} # Registry-Cache statt type=gha: der Gitea-Runner bringt keinen # Actions-Cache-Dienst mit. cache-from: type=registry,ref=${{ env.REGISTRY }}/${{ env.NAMESPACE }}/moneyfy-${{ matrix.component }}:buildcache cache-to: type=registry,ref=${{ env.REGISTRY }}/${{ env.NAMESPACE }}/moneyfy-${{ matrix.component }}:buildcache,mode=max provenance: false - name: Ergebnis zusammenfassen run: | echo "### moneyfy-${{ matrix.component }}" >> "$GITHUB_STEP_SUMMARY" echo '```' >> "$GITHUB_STEP_SUMMARY" echo "${{ steps.meta.outputs.tags }}" >> "$GITHUB_STEP_SUMMARY" echo '```' >> "$GITHUB_STEP_SUMMARY"