Simplify GHCR push process in build workflow

Replaced the old push block with a simplified push to GHCR using the redhat-actions/push-to-registry action, streamlining the process and removing unnecessary steps.
This commit is contained in:
humocs-man
2026-04-24 19:41:50 +02:00
committed by GitHub
parent d24b82e6be
commit 1e0df58fa4
+11 -36
View File
@@ -153,44 +153,19 @@ jobs:
username: ${{ github.actor }}
password: ${{ secrets.GITHUB_TOKEN }}
# Ersetze den Push-Block durch diesen hier:
- name: Push to GHCR with zstd using Skopeo (Archive Workaround)
- name: Push To GHCR
uses: redhat-actions/push-to-registry@5ed88d269cf581ea9ef6dd6806d01562096bee9c # v2
if: github.event_name != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
id: push
if: github.event_arm != 'pull_request' && github.ref == format('refs/heads/{0}', github.event.repository.default_branch)
run: |
# 1. Erstelle ein temporäres Verzeichnis für das OCI-Image
mkdir -p ./tmp-oci-image
# 2. Erstelle ein einfaches Tar-Archiv des lokalen Images.
# Das ist eine reine Datei-Operation und benötigt kein 'unshare'.
echo "Saving image to tar archive..."
podman save ${{ env.IMAGE_NAME }}:${{ env.DEFAULT_TAG }} -o image-archive.tar
for tag in ${{ steps.metadata.outputs.tags }}; do
echo "Processing tag: $tag"
# 3. SCHRITT 1: Konvertiere das Tar-Archiv in das OCI-Format.
# Wir nutzen 'docker-archive:', was ein einfaches Datei-Format ist.
# Skopeo liest die Datei und erstellt die OCI-Struktur.
skopeo copy \
docker-archive:image-archive.tar:latest \
oci:./tmp-oci-image
# 4. SCHRITT 2: Von OCI-Verzeichnis zur Registry pushen mit zstd.
# Hier wenden wir nun die gewünschte Kompression an.
skopeo copy \
--compression zstd \
oci:./tmp-oci-image \
${{ env.IMAGE_REGISTRY }}/${{ env.IMAGE_NAME }}:$tag
done
# 5. Aufräumen
rm -rf ./tmp-oci-image image-archive.tar
env:
IMAGE_NAME: ${{ env.IMAGE_NAME }}
IMAGE_REGISTRY: ${{ env.IMAGE_REGISTRY }}
DEFAULT_TAG: ${{ env.DEFAULT_TAG }}
REGISTRY_USER: ${{ github.actor }}
REGISTRY_PASSWORD: ${{ github.token }}
with:
registry: ${{ env.IMAGE_REGISTRY }}
image: ${{ env.IMAGE_NAME }}
tags: ${{ steps.metadata.outputs.tags }}
username: ${{ env.REGISTRY_USER }}
password: ${{ env.REGISTRY_PASSWORD }}
# OPTIONAL: Image Signing with Cosign
# Signing is disabled by default. To enable, see README.md "Optional: Enable Image Signing" section.