refactor: enhance Gitea registry login with fallback credentials and error handling
Build / build (push) Successful in 19s
Publish Docker Image / docker (push) Failing after 4s

This commit is contained in:
Lukas Höppner
2026-05-19 17:41:18 +02:00
parent 0899cc6741
commit 2da7168b78
+22 -1
View File
@@ -41,8 +41,29 @@ jobs:
- name: Log in to Gitea Container Registry - name: Log in to Gitea Container Registry
shell: sh 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: | 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 - name: Build and push image
shell: sh shell: sh