From 2da7168b78b995ec80bae62f0f10b3a096f07089 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Lukas=20H=C3=B6ppner?= Date: Tue, 19 May 2026 17:41:18 +0200 Subject: [PATCH] refactor: enhance Gitea registry login with fallback credentials and error handling --- .gitea/workflows/publish-image.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/.gitea/workflows/publish-image.yml b/.gitea/workflows/publish-image.yml index 50c32f3..2176249 100644 --- a/.gitea/workflows/publish-image.yml +++ b/.gitea/workflows/publish-image.yml @@ -41,8 +41,29 @@ jobs: - name: Log in to Gitea Container Registry shell: sh + env: + REGISTRY_USERNAME: ${{ secrets.GITEA_REGISTRY_USERNAME }} + REGISTRY_TOKEN: ${{ secrets.GITEA_REGISTRY_TOKEN }} + LEGACY_TOKEN: ${{ secrets.GITEA_TOKEN }} + ACTOR_USERNAME: ${{ github.actor }} run: | - echo "${{ secrets.GITEA_TOKEN }}" | docker login "${{ steps.meta.outputs.registry_host }}" -u "${{ github.actor }}" --password-stdin + USERNAME="$REGISTRY_USERNAME" + TOKEN="$REGISTRY_TOKEN" + + if [ -z "$USERNAME" ]; then + USERNAME="$ACTOR_USERNAME" + fi + + if [ -z "$TOKEN" ]; then + TOKEN="$LEGACY_TOKEN" + fi + + if [ -z "$USERNAME" ] || [ -z "$TOKEN" ]; then + echo "Registry login failed: set GITEA_REGISTRY_USERNAME and GITEA_REGISTRY_TOKEN (or fallback GITEA_TOKEN)." + exit 1 + fi + + echo "$TOKEN" | docker login "${{ steps.meta.outputs.registry_host }}" -u "$USERNAME" --password-stdin - name: Build and push image shell: sh