Files
Draupnir/.github/workflows/ghcr-all-dev-branches.yml
renovate[bot] 1372c17db9 Update docker/setup-qemu-action action to v4 (#1038)
Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com>
2026-03-14 12:34:04 +01:00

77 lines
2.4 KiB
YAML

# SPDX-FileCopyrightText: 2026 Catalan Lover <catalanlover@protonmail.com>
#
# SPDX-License-Identifier: CC0-1.0
# This file is derived from the docker-hub-develop.yml workflow, but instead of pushing to Docker Hub, it pushes to GHCR. It also runs on all non excluded branches to allow easier access to development builds.
name: "GHCR - Development Branches"
on:
push:
branches-ignore:
- "dependabot/**"
- "renovate/**"
- "github-actions/**"
env:
IMAGE_NAME: draupnir
PLATFORMS: linux/amd64,linux/arm64
IMG_SOURCE: https://github.com/${{ github.repository }}
jobs:
ghcr-publish:
runs-on: ubuntu-latest
permissions:
id-token: write
packages: write
contents: read
attestations: write
steps:
- name: Check out
uses: actions/checkout@v6
- name: Unshallow for git describe so we can create version.txt
run: git fetch --prune --unshallow --tags --all --force
- name: Set lowercase image owner
run: echo "IMAGE_OWNER=$(echo '${{ github.repository_owner }}' | tr '[:upper:]' '[:lower:]')" >> $GITHUB_ENV
# Needed for multi platform builds
- name: Set up QEMU
uses: docker/setup-qemu-action@v4
with:
platforms: ${{ env.PLATFORMS }}
- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v4
- name: Log in to GHCR
uses: docker/login-action@v4
with:
registry: ghcr.io
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
- name: Derive image tags
id: meta
uses: docker/metadata-action@v6
with:
images: ghcr.io/${{ env.IMAGE_OWNER }}/${{ env.IMAGE_NAME }}
tags: |
type=ref,event=branch
type=sha,prefix=sha-
- name: Build image
id: push
uses: docker/build-push-action@v7
with:
context: .
file: ./Dockerfile
platforms: ${{ env.PLATFORMS }}
push: true
labels: |
org.opencontainers.image.source=${{ env.IMG_SOURCE }}
org.opencontainers.image.revision=${{ github.sha }}
org.opencontainers.image.version=${{ github.ref_name }}-${{ github.sha }}
org.opencontainers.image.ref.name=${{ github.ref_name }}
org.opencontainers.image.licenses=AFL-3.0
sbom: true
tags: ${{ steps.meta.outputs.tags }}