42 lines
1.1 KiB
YAML
42 lines
1.1 KiB
YAML
name: Build and Push Docker Image
|
|
|
|
on:
|
|
push:
|
|
branches:
|
|
- main
|
|
tags:
|
|
- 'v*'
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout Code
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Log in to Gitea Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: ${{ gitea.server_url }}
|
|
username: ${{ gitea.actor }} # Nutzt den Namen des Pushers
|
|
password: ${{ secrets.GITEA_TOKEN }} # Oder ${{ gitea.token }}
|
|
|
|
- name: Extract Metadata (Tags/Labels)
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: ${{ gitea.server_url }}/${{ gitea.repository }}
|
|
tags: |
|
|
type=raw,value=latest
|
|
type=ref,event=branch
|
|
type=semver,pattern={{version}}
|
|
|
|
- name: Build and Push Docker Image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
file: ./Dockerfile
|
|
push: true
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|