fixed runner again gai
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1s
Some checks failed
Build and Push Docker Image / build-and-push (push) Failing after 1s
This commit is contained in:
@@ -18,6 +18,8 @@ jobs:
|
|||||||
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}"
|
TOKEN="${GITHUB_TOKEN:-$GITEA_TOKEN}"
|
||||||
|
CLONE_USER="${{ secrets.REGISTRY_USERNAME }}"
|
||||||
|
CLONE_PASS="${{ secrets.REGISTRY_PASSWORD }}"
|
||||||
REF_NAME="${GITHUB_REF_NAME}"
|
REF_NAME="${GITHUB_REF_NAME}"
|
||||||
if [ -z "${REF_NAME}" ]; then
|
if [ -z "${REF_NAME}" ]; then
|
||||||
REF_NAME="${GITHUB_REF#refs/heads/}"
|
REF_NAME="${GITHUB_REF#refs/heads/}"
|
||||||
@@ -28,15 +30,21 @@ jobs:
|
|||||||
exit 1
|
exit 1
|
||||||
fi
|
fi
|
||||||
|
|
||||||
if [ -z "${TOKEN}" ]; then
|
|
||||||
echo "Missing GITHUB_TOKEN/GITEA_TOKEN; cannot clone private repository"
|
|
||||||
exit 1
|
|
||||||
fi
|
|
||||||
|
|
||||||
rm -rf "${REPO_DIR}"
|
rm -rf "${REPO_DIR}"
|
||||||
|
|
||||||
|
if [ -n "${TOKEN}" ]; then
|
||||||
git clone --depth 1 --branch "${REF_NAME}" \
|
git clone --depth 1 --branch "${REF_NAME}" \
|
||||||
"https://oauth2:${TOKEN}@${SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" \
|
"https://oauth2:${TOKEN}@${SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" \
|
||||||
"${REPO_DIR}"
|
"${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
|
||||||
|
fi
|
||||||
|
|
||||||
if [ ! -f "${REPO_DIR}/Dockerfile" ]; then
|
if [ ! -f "${REPO_DIR}/Dockerfile" ]; then
|
||||||
echo "Dockerfile not found after clone"
|
echo "Dockerfile not found after clone"
|
||||||
|
|||||||
Reference in New Issue
Block a user