Files
immich-folio/.github/workflows/docker-publish.yml
Ralksta 1c9b6f09aa fix(ci): Trivy-Action-Referenz existierte nicht (#409)
aquasecurity/trivy-action@0.29.0 gibt es nicht -- die Tags des
Repositories tragen ein fuehrendes v (v0.29.0). Der Publish-Job brach
deshalb nach sieben Sekunden im Action-Setup ab, noch bevor das Image
gebaut wurde: fuer v0.10.0 liegt kein Image auf ghcr.io.

Jetzt auf den Commit-SHA von v0.36.0 gepinnt statt auf einen Tag. Ein
Tag in einer fremden Action ist verschiebbar, und der Job hat
security-events: write.

Co-authored-by: ralksta <ralksta@users.noreply.github.com>
Co-authored-by: Claude Opus 5 (1M context) <noreply@anthropic.com>
2026-08-10 09:59:21 +02:00

77 lines
2.3 KiB
YAML

name: Publish Docker Image
on:
release:
types: [published]
workflow_dispatch:
env:
REGISTRY: ghcr.io
IMAGE_NAME: ${{ github.repository }}
jobs:
build-and-push:
runs-on: ubuntu-latest
permissions:
contents: read
packages: write
security-events: write
steps:
- name: Checkout repository
uses: actions/checkout@v7
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to the Container registry
uses: docker/login-action@v4
with:
registry: ${{ env.REGISTRY }}
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v6
with:
images: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}
tags: |
type=semver,pattern={{version}}
type=semver,pattern={{major}}.{{minor}}
type=semver,pattern={{major}}
type=ref,event=branch
type=sha,format=long
type=raw,value=latest,enable=${{ github.event_name == 'release' }}
- name: Build and push Docker image
id: build
uses: docker/build-push-action@v7
with:
context: .
push: true
tags: ${{ steps.meta.outputs.tags }}
labels: ${{ steps.meta.outputs.labels }}
cache-from: type=gha
cache-to: type=gha,mode=max
- name: Scan image for vulnerabilities
# Pinned to a commit SHA, not a tag: the action's tags carry a leading
# "v" (v0.36.0), so the previous "@0.29.0" resolved to nothing and the
# job failed at action setup — before the image was ever built.
uses: aquasecurity/trivy-action@ed142fd0673e97e23eac54620cfb913e5ce36c25 # v0.36.0
with:
image-ref: ${{ env.REGISTRY }}/${{ env.IMAGE_NAME }}@${{ steps.build.outputs.digest }}
format: sarif
output: trivy-results.sarif
severity: CRITICAL,HIGH
exit-code: '0'
- name: Upload scan results to GitHub Security tab
uses: github/codeql-action/upload-sarif@v3
with:
sarif_file: trivy-results.sarif