fix: Breaking update due to new deployment scripts

This commit is contained in:
beilunyang
2025-03-09 12:03:35 +08:00
parent dae8122231
commit 436666a88b

View File

@@ -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')