From 436666a88bb2f08f7a8c59c1fbe4fe70d6682102 Mon Sep 17 00:00:00 2001 From: beilunyang <786220806@qq.com> Date: Sun, 9 Mar 2025 12:03:35 +0800 Subject: [PATCH] fix: Breaking update due to new deployment scripts --- scripts/deploy/index.ts | 14 +++++++++++--- 1 file changed, 11 insertions(+), 3 deletions(-) diff --git a/scripts/deploy/index.ts b/scripts/deploy/index.ts index 386f292..123d550 100644 --- a/scripts/deploy/index.ts +++ b/scripts/deploy/index.ts @@ -258,6 +258,17 @@ const checkAndCreatePages = async () => { */ const pushPagesSecret = () => { console.log("🔐 Pushing environment secrets to Pages..."); + + // 定义运行时所需的环境变量列表 + const runtimeEnvVars = ['AUTH_GITHUB_ID', 'AUTH_GITHUB_SECRET', 'AUTH_SECRET']; + + // 兼容老的部署方式,如果这些环境变量不存在,则说明是老的部署方式,跳过推送 + for (const varName of runtimeEnvVars) { + if (!process.env[varName]) { + console.log(`🔐 Skipping pushing secrets to Pages...`); + return; + } + } try { // 确保.env文件存在 @@ -269,9 +280,6 @@ const pushPagesSecret = () => { const envContent = readFileSync(resolve('.env'), 'utf-8'); const runtimeEnvFile = resolve('.env.runtime'); - // 定义运行时所需的环境变量列表 - const runtimeEnvVars = ['AUTH_GITHUB_ID', 'AUTH_GITHUB_SECRET', 'AUTH_SECRET']; - // 从.env文件中提取运行时变量 const runtimeEnvContent = envContent .split('\n')