Skip to content

Commit d9b5de0

Browse files
xkcodingclaude
andcommitted
feat: SSL 工作流添加强制重新申请选项
用于添加新域名时删除旧证书并重新申请 Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
1 parent 17a7049 commit d9b5de0

1 file changed

Lines changed: 16 additions & 0 deletions

File tree

.github/workflows/ssl-manage.yml

Lines changed: 16 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,6 +6,12 @@ on:
66
- cron: "0 19 1,15 * *" # UTC 19:00 = 北京时间 03:00
77
# 支持手动触发
88
workflow_dispatch:
9+
inputs:
10+
force_renew:
11+
description: "强制重新申请证书(添加新域名时使用)"
12+
required: false
13+
type: boolean
14+
default: false
915

1016
env:
1117
DOMAINS: "xkcoding.com,www.xkcoding.com,blog.xkcoding.com"
@@ -33,6 +39,16 @@ jobs:
3339
echo "🔐 检查 SSL 证书状态..."
3440
echo "📋 域名列表: $DOMAINS"
3541
42+
# 强制重新申请时删除旧证书
43+
FORCE_RENEW="${{ github.event.inputs.force_renew }}"
44+
if [ "$FORCE_RENEW" = "true" ] && [ -d "$CERT_PATH" ]; then
45+
echo "🗑️ 强制模式:删除旧证书..."
46+
rm -rf /opt/myblog/certbot/etc/live/xkcoding.com
47+
rm -rf /opt/myblog/certbot/etc/archive/xkcoding.com
48+
rm -rf /opt/myblog/certbot/etc/renewal/xkcoding.com.conf
49+
echo "✅ 旧证书已删除"
50+
fi
51+
3652
# 创建必要目录
3753
mkdir -p /opt/myblog/dist
3854
mkdir -p /opt/myblog/certbot/etc

0 commit comments

Comments
 (0)