ci(deploy): fix image cleanup and shorten notifications

This commit is contained in:
2026-07-09 15:58:10 +08:00
parent 48b74d1d62
commit ab63fe002f
2 changed files with 4 additions and 15 deletions
+2 -13
View File
@@ -28,10 +28,7 @@ if [ -z "$notify_url" ]; then
fi fi
deploy_env="${DEPLOY_ENV:-unknown}" deploy_env="${DEPLOY_ENV:-unknown}"
image_tag="${IMAGE_VERSION_TAG:-unknown}"
job_status="${ACTION_JOB_STATUS:-unknown}" job_status="${ACTION_JOB_STATUS:-unknown}"
workflow_name="${GITHUB_WORKFLOW:-Docker Image}"
repository="${GITHUB_REPOSITORY:-cozsweet-frontend-nextjs}"
run_url="" run_url=""
if [ -n "${GITHUB_SERVER_URL:-}" ] && [ -n "${GITHUB_REPOSITORY:-}" ] && [ -n "${GITHUB_RUN_ID:-}" ]; then if [ -n "${GITHUB_SERVER_URL:-}" ] && [ -n "${GITHUB_REPOSITORY:-}" ] && [ -n "${GITHUB_RUN_ID:-}" ]; then
@@ -42,16 +39,8 @@ if [ -z "$run_url" ]; then
fi fi
export ACTION_NOTIFY_MESSAGE="$(cat <<EOF export ACTION_NOTIFY_MESSAGE="$(cat <<EOF
Gitea workflow finished. $job_status $deploy_env/$branch_name $short_sha
$run_url
Workflow: $workflow_name
Repository: $repository
Branch: $branch_name
Environment: $deploy_env
Commit: $short_sha
Image: $image_tag
Status: $job_status
Run: $run_url
EOF EOF
)" )"
+2 -2
View File
@@ -57,11 +57,11 @@ prune_project_images() {
return 0 return 0
fi fi
local image_repo="${IMAGE%%:*}" local image_repo="${IMAGE%:*}"
local image_tag="${IMAGE##*:}" local image_tag="${IMAGE##*:}"
local tag_prefix="${image_tag%%-*}-" local tag_prefix="${image_tag%%-*}-"
if [ -z "$image_repo" ] || [ "$image_repo" = "$IMAGE" ] || [ -z "$tag_prefix" ]; then if [ -z "$image_repo" ] || [ "$image_repo" = "$IMAGE" ] || [ -z "$image_tag" ] || [ "$image_tag" = "$IMAGE" ] || [ -z "$tag_prefix" ]; then
echo "Skip project image prune: could not parse image repo/tag from $IMAGE" echo "Skip project image prune: could not parse image repo/tag from $IMAGE"
return 0 return 0
fi fi