移除代码检出步骤,添加工作区验证
Server CI/CD / docker-image (push) Failing after 1s
Server CI/CD / deploy-fallback-log (push) Successful in 0s

This commit is contained in:
2026-06-10 15:41:59 +08:00
parent 2af89eea1c
commit 2a823b2616
+7 -34
View File
@@ -18,40 +18,6 @@ jobs:
shell: bash shell: bash
steps: steps:
- name: Checkout code
env:
SERVER_URL: ${{ github.server_url }}
REPOSITORY: ${{ github.repository }}
COMMIT_SHA: ${{ github.sha }}
GIT_USERNAME: ${{ github.actor }}
GIT_TOKEN: ${{ github.token }}
run: |
case "$SERVER_URL" in
http://*)
AUTH_SERVER_URL="http://${GIT_USERNAME}:${GIT_TOKEN}@${SERVER_URL#http://}"
;;
https://*)
AUTH_SERVER_URL="https://${GIT_USERNAME}:${GIT_TOKEN}@${SERVER_URL#https://}"
;;
*)
AUTH_SERVER_URL="$SERVER_URL"
;;
esac
if [ ! -d .git ]; then
git init .
fi
if git remote get-url origin >/dev/null 2>&1; then
git remote set-url origin "${AUTH_SERVER_URL}/${REPOSITORY}.git"
else
git remote add origin "${AUTH_SERVER_URL}/${REPOSITORY}.git"
fi
git fetch --depth=1 origin "$COMMIT_SHA"
git checkout --force --detach FETCH_HEAD
git clean -ffdx
- name: Normalize image metadata - name: Normalize image metadata
env: env:
RAW_REGISTRY_HOST: ${{ vars.REGISTRY_HOST }} RAW_REGISTRY_HOST: ${{ vars.REGISTRY_HOST }}
@@ -158,6 +124,13 @@ jobs:
exit 1 exit 1
fi fi
- name: Validate workspace
run: |
if [ ! -f ./Dockerfile ]; then
echo "Dockerfile not found in workspace. Checkout is disabled, so the runner must provide repository files before this job starts."
exit 1
fi
- name: Build and Push Image - name: Build and Push Image
run: | run: |
if [ -z "${IMAGE_NAME:-}" ] || [ -z "${IMAGE_TAG:-}" ]; then if [ -z "${IMAGE_NAME:-}" ] || [ -z "${IMAGE_TAG:-}" ]; then