fixed runner again again
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 0s

This commit is contained in:
Richard Mrasek
2026-06-11 15:31:23 +02:00
parent a63675c36d
commit dd71829735

View File

@@ -17,7 +17,8 @@ jobs:
run: | run: |
REPO_DIR="repo" REPO_DIR="repo"
SERVER_URL="${GITHUB_SERVER_URL:-$GITEA_SERVER_URL}" SERVER_URL="${GITHUB_SERVER_URL:-$GITEA_SERVER_URL}"
TOKEN="${GITHUB_TOKEN:-$GITEA_TOKEN}" SERVER_SCHEME="https"
SERVER_HOST="${SERVER_URL}"
CLONE_USER="${{ secrets.REGISTRY_USERNAME }}" CLONE_USER="${{ secrets.REGISTRY_USERNAME }}"
CLONE_PASS="${{ secrets.REGISTRY_PASSWORD }}" CLONE_PASS="${{ secrets.REGISTRY_PASSWORD }}"
REF_NAME="${GITHUB_REF_NAME}" REF_NAME="${GITHUB_REF_NAME}"
@@ -30,22 +31,27 @@ jobs:
exit 1 exit 1
fi fi
rm -rf "${REPO_DIR}" if [ -z "${CLONE_USER}" ] || [ -z "${CLONE_PASS}" ]; then
echo "Missing REGISTRY_USERNAME or REGISTRY_PASSWORD secret"
if [ -n "${TOKEN}" ]; then
git clone --depth 1 --branch "${REF_NAME}" \
"https://oauth2:${TOKEN}@${SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" \
"${REPO_DIR}"
elif [ -n "${CLONE_USER}" ] && [ -n "${CLONE_PASS}" ]; then
git clone --depth 1 --branch "${REF_NAME}" \
"https://${CLONE_USER}:${CLONE_PASS}@${SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" \
"${REPO_DIR}"
else
echo "Missing CI token and fallback clone credentials"
echo "Set GITHUB_TOKEN/GITEA_TOKEN or REGISTRY_USERNAME/REGISTRY_PASSWORD secrets"
exit 1 exit 1
fi fi
case "${SERVER_URL}" in
http://*)
SERVER_SCHEME="http"
SERVER_HOST="${SERVER_URL#http://}"
;;
https://*)
SERVER_SCHEME="https"
SERVER_HOST="${SERVER_URL#https://}"
;;
esac
rm -rf "${REPO_DIR}"
git clone --depth 1 --branch "${REF_NAME}" \
"${SERVER_SCHEME}://${CLONE_USER}:${CLONE_PASS}@${SERVER_HOST}/${GITHUB_REPOSITORY}.git" \
"${REPO_DIR}"
if [ ! -f "${REPO_DIR}/Dockerfile" ]; then if [ ! -f "${REPO_DIR}/Dockerfile" ]; then
echo "Dockerfile not found after clone" echo "Dockerfile not found after clone"
exit 1 exit 1