harbor_host configurable

This commit is contained in:
2026-04-23 07:48:15 +08:00
parent 134ebd528b
commit 23172c402d
+6 -1
View File
@@ -19,6 +19,10 @@ inputs:
harbor_secret: harbor_secret:
description: 'Harbor Secret' description: 'Harbor Secret'
required: true required: true
harbor_host:
description: 'Docker Registry Host'
required: false
default: 'harbor.hclife.co'
image_tag: image_tag:
description: 'Image Tag to deploy' description: 'Image Tag to deploy'
required: true required: true
@@ -44,6 +48,7 @@ runs:
DEPLOY_USER: ${{ inputs.user }} DEPLOY_USER: ${{ inputs.user }}
HARBOR_USER: ${{ inputs.harbor_user }} HARBOR_USER: ${{ inputs.harbor_user }}
HARBOR_SECRET: ${{ inputs.harbor_secret }} HARBOR_SECRET: ${{ inputs.harbor_secret }}
HARBOR_HOST: ${{ inputs.harbor_host }}
IMAGE_TAG: ${{ inputs.image_tag }} IMAGE_TAG: ${{ inputs.image_tag }}
APP_KEY: ${{ inputs.app_key }} APP_KEY: ${{ inputs.app_key }}
AUTO_DEPLOY_PATH: ${{ inputs.auto_deploy_path }} AUTO_DEPLOY_PATH: ${{ inputs.auto_deploy_path }}
@@ -66,4 +71,4 @@ runs:
) )
ssh "${SSH_OPTS[@]}" "$DEPLOY_USER@$DEPLOY_HOST" \ ssh "${SSH_OPTS[@]}" "$DEPLOY_USER@$DEPLOY_HOST" \
"APP_KEY=$(printf '%q' "$APP_KEY") IMAGE_TAG=$(printf '%q' "$IMAGE_TAG") HARBOR_USER=$(printf '%q' "$HARBOR_USER") HARBOR_SECRET=$(printf '%q' "$HARBOR_SECRET") AUTO_DEPLOY_PATH=$(printf '%q' "$AUTO_DEPLOY_PATH") AUTO_DEPLOY_BRANCH=$(printf '%q' "$AUTO_DEPLOY_BRANCH") bash -se -c 'printf \"%s\" \"\$HARBOR_SECRET\" | sudo /usr/bin/docker login harbor.hclife.co -u \"\$HARBOR_USER\" --password-stdin; echo \"[remote] Harbor login succeeded\"; cd \"\$AUTO_DEPLOY_PATH\"; git checkout \"\$AUTO_DEPLOY_BRANCH\"; git pull --ff-only; git submodule sync --recursive; git submodule update --init --recursive; echo \"[remote] auto-deploy repo updated\"; ./common/deploy.sh deploy \"\$APP_KEY\" \"\$IMAGE_TAG\"; echo \"[remote] \$APP_KEY deploy staged with IMAGE_TAG=\$IMAGE_TAG\"; echo \"[remote] current deployment status:\"; ./common/deploy.sh status \"\$APP_KEY\" --format env'" "APP_KEY=$(printf '%q' "$APP_KEY") IMAGE_TAG=$(printf '%q' "$IMAGE_TAG") HARBOR_USER=$(printf '%q' "$HARBOR_USER") HARBOR_SECRET=$(printf '%q' "$HARBOR_SECRET") HARBOR_HOST=$(printf '%q' "$HARBOR_HOST") AUTO_DEPLOY_PATH=$(printf '%q' "$AUTO_DEPLOY_PATH") AUTO_DEPLOY_BRANCH=$(printf '%q' "$AUTO_DEPLOY_BRANCH") bash -se -c 'printf \"%s\" \"\$HARBOR_SECRET\" | sudo /usr/bin/docker login \"\$HARBOR_HOST\" -u \"\$HARBOR_USER\" --password-stdin; echo \"[remote] Harbor login succeeded\"; cd \"\$AUTO_DEPLOY_PATH\"; git checkout \"\$AUTO_DEPLOY_BRANCH\"; git pull --ff-only; git submodule sync --recursive; git submodule update --init --recursive; echo \"[remote] auto-deploy repo updated\"; ./common/deploy.sh deploy \"\$APP_KEY\" \"\$IMAGE_TAG\"; echo \"[remote] \$APP_KEY deploy staged with IMAGE_TAG=\$IMAGE_TAG\"; echo \"[remote] current deployment status:\"; ./common/deploy.sh status \"\$APP_KEY\" --format env'"