52 lines
1.5 KiB
YAML
52 lines
1.5 KiB
YAML
---
|
|
name: Build and Publish Docker Image
|
|
on:
|
|
push:
|
|
branches:
|
|
- master
|
|
tags:
|
|
- '*'
|
|
|
|
jobs:
|
|
build-and-push:
|
|
runs-on: ubuntu-latest
|
|
steps:
|
|
- name: Checkout
|
|
uses: actions/checkout@v4
|
|
|
|
- name: Set up Docker Buildx
|
|
uses: docker/setup-buildx-action@v3
|
|
|
|
- name: Log in to Zot Container Registry
|
|
uses: docker/login-action@v3
|
|
with:
|
|
registry: registry.br0tkasten.de
|
|
username: runner
|
|
# Zot credentials for runner, stored in the Gitea Actions secret TOKEN.
|
|
password: ${{ secrets.TOKEN }}
|
|
|
|
- name: Extract metadata (tags, labels) for Docker
|
|
id: meta
|
|
uses: docker/metadata-action@v5
|
|
with:
|
|
images: registry.br0tkasten.de/${{ gitea.repository }}
|
|
flavor: |
|
|
latest=true
|
|
tags: |
|
|
type=ref,event=branch
|
|
type=semver,pattern={{version}}
|
|
type=sha
|
|
|
|
- name: Build and push Docker image
|
|
uses: docker/build-push-action@v5
|
|
with:
|
|
context: .
|
|
outputs: type=registry,oci-mediatypes=true
|
|
# Keep a single image manifest with the annotations required by Zot's linter.
|
|
provenance: false
|
|
annotations: |
|
|
manifest:org.opencontainers.image.vendor=br0tkasten.de
|
|
manifest:org.opencontainers.image.licenses=MIT
|
|
tags: ${{ steps.meta.outputs.tags }}
|
|
labels: ${{ steps.meta.outputs.labels }}
|