diff --git a/.gitea/workflows/build-and-push.yaml b/.gitea/workflows/build-and-push.yaml index b1c5bb6..526f0c0 100644 --- a/.gitea/workflows/build-and-push.yaml +++ b/.gitea/workflows/build-and-push.yaml @@ -47,9 +47,26 @@ jobs: - name: Login to Gitea registry run: | - echo "${{ secrets.REGISTRY_TOKEN }}" | docker login \ + REGISTRY_USERNAME="${{ secrets.REGISTRY_USERNAME }}" + REGISTRY_TOKEN="${{ secrets.REGISTRY_TOKEN }}" + + if [ -z "${REGISTRY_USERNAME}" ]; then + REGISTRY_USERNAME="${{ gitea.actor }}" + fi + + if [ -z "${REGISTRY_USERNAME}" ]; then + echo "Registry username is missing. Set REGISTRY_USERNAME or run the workflow with a valid Gitea actor." + exit 1 + fi + + if [ -z "${REGISTRY_TOKEN}" ]; then + echo "Registry token is missing. Set REGISTRY_TOKEN as a repository or organization secret." + exit 1 + fi + + echo "${REGISTRY_TOKEN}" | docker login \ "${{ steps.meta.outputs.registry_host }}" \ - --username "${{ secrets.REGISTRY_USERNAME }}" \ + --username "${REGISTRY_USERNAME}" \ --password-stdin - name: Build image