From aa8f801a0448895937f5aadc0ad1bb0bb8b62665 Mon Sep 17 00:00:00 2001 From: Huarch Date: Tue, 19 May 2026 11:55:17 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=8E=AF=E5=A2=83=E5=8F=98?= =?UTF-8?q?=E9=87=8F=E6=A3=80=E6=9F=A5=EF=BC=8C=E7=A1=AE=E4=BF=9D=E6=B3=A8?= =?UTF-8?q?=E5=86=8C=E4=BF=A1=E6=81=AF=E5=AE=8C=E6=95=B4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/package.yml | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml index 8be6ed2..882e86c 100644 --- a/.gitea/workflows/package.yml +++ b/.gitea/workflows/package.yml @@ -145,6 +145,8 @@ jobs: RAW_REF: ${{ github.ref }} RAW_REF_NAME: ${{ github.ref_name }} run: | + RAW_REGISTRY_HOST="$(printf '%s' "${RAW_REGISTRY_HOST}" | sed 's/^[[:space:]]*//;s/[[:space:]]*$//')" + if [ -z "${RAW_REGISTRY_HOST}" ]; then echo "Missing required repository variable: REGISTRY_HOST" exit 1 @@ -177,6 +179,12 @@ jobs: REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} run: | + if [ -z "${REGISTRY_HOST:-}" ]; then + echo "Missing resolved environment value: REGISTRY_HOST" + echo "The previous step should write REGISTRY_HOST into GITHUB_ENV." + exit 1 + fi + if [ -z "${REGISTRY_USERNAME}" ]; then echo "Missing required repository secret: REGISTRY_USERNAME" exit 1 @@ -187,12 +195,18 @@ jobs: exit 1 fi + echo "Logging into registry host: ${REGISTRY_HOST}" echo "${REGISTRY_PASSWORD}" | docker login "$REGISTRY_HOST" \ --username "${REGISTRY_USERNAME}" \ --password-stdin - name: Build and Push Image run: | + if [ -z "${IMAGE_NAME:-}" ] || [ -z "${IMAGE_TAG:-}" ]; then + echo "Missing resolved image metadata: IMAGE_NAME or IMAGE_TAG" + exit 1 + fi + push_with_retry() { image_ref="$1" attempt=1