From 2a823b261612c60e4f80bae7d284b5904dd37372 Mon Sep 17 00:00:00 2001 From: Jiang Date: Wed, 10 Jun 2026 15:41:59 +0800 Subject: [PATCH] =?UTF-8?q?=E7=A7=BB=E9=99=A4=E4=BB=A3=E7=A0=81=E6=A3=80?= =?UTF-8?q?=E5=87=BA=E6=AD=A5=E9=AA=A4=EF=BC=8C=E6=B7=BB=E5=8A=A0=E5=B7=A5?= =?UTF-8?q?=E4=BD=9C=E5=8C=BA=E9=AA=8C=E8=AF=81?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/package.yml | 41 ++++++------------------------------ 1 file changed, 7 insertions(+), 34 deletions(-) diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml index 3bf812e..b094f71 100644 --- a/.gitea/workflows/package.yml +++ b/.gitea/workflows/package.yml @@ -18,40 +18,6 @@ jobs: shell: bash 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 env: RAW_REGISTRY_HOST: ${{ vars.REGISTRY_HOST }} @@ -158,6 +124,13 @@ jobs: exit 1 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 run: | if [ -z "${IMAGE_NAME:-}" ] || [ -z "${IMAGE_TAG:-}" ]; then