From a6f6e633f01d4cb6258046be0f5a1209aa804c2f Mon Sep 17 00:00:00 2001 From: Huarch Date: Tue, 19 May 2026 11:51:06 +0800 Subject: [PATCH] =?UTF-8?q?=E6=B7=BB=E5=8A=A0=E7=BC=BA=E5=A4=B1=E7=9A=84?= =?UTF-8?q?=E7=8E=AF=E5=A2=83=E5=8F=98=E9=87=8F=E5=92=8C=E5=AF=86=E9=92=A5?= =?UTF-8?q?=E6=A3=80=E6=9F=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .gitea/workflows/package.yml | 28 ++++++++++++++++++++++++++-- 1 file changed, 26 insertions(+), 2 deletions(-) diff --git a/.gitea/workflows/package.yml b/.gitea/workflows/package.yml index e63f5bb..8be6ed2 100644 --- a/.gitea/workflows/package.yml +++ b/.gitea/workflows/package.yml @@ -145,9 +145,20 @@ jobs: RAW_REF: ${{ github.ref }} RAW_REF_NAME: ${{ github.ref_name }} run: | + if [ -z "${RAW_REGISTRY_HOST}" ]; then + echo "Missing required repository variable: REGISTRY_HOST" + exit 1 + fi + REGISTRY_HOST="${RAW_REGISTRY_HOST#http://}" REGISTRY_HOST="${REGISTRY_HOST#https://}" REGISTRY_HOST="${REGISTRY_HOST%/}" + + if [ -z "${REGISTRY_HOST}" ]; then + echo "Repository variable REGISTRY_HOST resolves to an empty host" + exit 1 + fi + REPOSITORY_PATH="${RAW_REPOSITORY#/}" IMAGE_REPOSITORY_PATH="$(printf '%s' "$REPOSITORY_PATH" | tr '[:upper:]' '[:lower:]')" IMAGE_NAME="${REGISTRY_HOST}/${IMAGE_REPOSITORY_PATH}" @@ -162,9 +173,22 @@ jobs: } >> "$GITHUB_ENV" - name: Login to Gitea Container Registry + env: + REGISTRY_USERNAME: ${{ secrets.REGISTRY_USERNAME }} + REGISTRY_PASSWORD: ${{ secrets.REGISTRY_PASSWORD }} run: | - echo "${{ secrets.REGISTRY_PASSWORD }}" | docker login "$REGISTRY_HOST" \ - --username "${{ secrets.REGISTRY_USERNAME }}" \ + if [ -z "${REGISTRY_USERNAME}" ]; then + echo "Missing required repository secret: REGISTRY_USERNAME" + exit 1 + fi + + if [ -z "${REGISTRY_PASSWORD}" ]; then + echo "Missing required repository secret: REGISTRY_PASSWORD" + exit 1 + fi + + echo "${REGISTRY_PASSWORD}" | docker login "$REGISTRY_HOST" \ + --username "${REGISTRY_USERNAME}" \ --password-stdin - name: Build and Push Image