Some checks failed
Docker Image Build & Push / push_to_registry (push) Has been cancelled
revert added Dockerfile and adapted build.yaml
45 lines
1.3 KiB
YAML
45 lines
1.3 KiB
YAML
name: Docker Image Build & Push
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- 'main' # Baut bei jedem Commit auf main
|
|
release:
|
|
types: [published] # Baut bei jedem neuen Release
|
|
|
|
jobs:
|
|
push_to_registry:
|
|
runs-on: ubuntu-latest
|
|
permissions:
|
|
packages: write
|
|
contents: read
|
|
|
|
steps:
|
|
- name: Check out the repo
|
|
uses: actions/checkout@v4
|
|
|
|
# 1. Login in die Gitea Container Registry
|
|
- name: Log in to the Container registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: gitea.penry.de # <-- HIER DEINE GITEA URL ANPASSEN (ohne https://)
|
|
username: ${{ github.actor }}
|
|
password: ${{ secrets.GITHUB_TOKEN }}
|
|
|
|
# 2. Metadaten extrahieren (Das ist der magische Teil)
|
|
# Er sorgt dafür, dass bei einem Commit das Tag "main" oder "latest" genutzt wird
|
|
# und bei einem Release das Tag "v1.2.3"
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: gitea.penry.de/${{ github.repository }}
|
|
|
|
# 3. Bauen und Pushen
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }} |