chore: move env examples to env-example/ and unify CDN env source
- Reorganize env example files into a dedicated env-example/ directory for clarity - Update .gitignore to ignore env files (with examples now in env-example/) - Unify CDN credentials (CF_ZONE_ID / CF_API_TOKEN) to be sourced from .env.local in both test and production deploys - Update git_hooks/post-receive to copy production env example from new location - Update deploy scripts (pre_release_web.sh, release_web.sh) to copy the appropriate env example into .env.local before building - Update _deploy_lib.sh purge_cdn_cache to source from .env.local instead of .env
This commit is contained in:
@@ -87,14 +87,14 @@ bump_version() {
|
||||
}
|
||||
|
||||
# 清除 Cloudflare CDN 缓存
|
||||
# 凭据从 .env / .env.local 读(CF_ZONE_ID / CF_API_TOKEN)
|
||||
# 凭据从 .env.local 读(CF_ZONE_ID / CF_API_TOKEN)
|
||||
purge_cdn_cache() {
|
||||
# 从 .env 读 CDN 凭据(Next.js 不读取,bash 直接 source)
|
||||
if [ -f .env ]; then
|
||||
# 从 .env.local 读 CDN 凭据(Next.js 不读取,bash 直接 source)
|
||||
if [ -f .env.local ]; then
|
||||
# shell 解析 KEY=VALUE(忽略注释 / 引号)
|
||||
set -a
|
||||
# shellcheck disable=SC1091
|
||||
source .env 2>/dev/null || true
|
||||
source .env.local 2>/dev/null || true
|
||||
set +a
|
||||
fi
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ cp -f icons/test/favicon.ico public/favicon.ico
|
||||
cp -f icons/test/icons/Icon-192.png public/images/icons/Icon-192.png
|
||||
cp -f icons/test/icons/Icon-512.png public/images/icons/Icon-512.png
|
||||
|
||||
# 准备测试环境变量(env-example/.env.local.example → .env.local,供 purge_cdn_cache 读 CDN 凭据)
|
||||
echo "=== 准备测试环境变量(env-example/.env.local.example → .env.local) ==="
|
||||
cp -f env-example/.env.local.example .env.local
|
||||
|
||||
echo "=== 执行构建部署脚本(测试环境)==="
|
||||
./scripts/deploy/deploy_web_test.sh
|
||||
|
||||
|
||||
@@ -18,6 +18,10 @@ cp -f icons/production/favicon.ico public/favicon.ico
|
||||
cp -f icons/production/icons/Icon-192.png public/images/icons/Icon-192.png
|
||||
cp -f icons/production/icons/Icon-512.png public/images/icons/Icon-512.png
|
||||
|
||||
# 准备生产环境变量(env-example/.env.production.example → .env.local,供 purge_cdn_cache 读 CDN 凭据)
|
||||
echo "=== 准备生产环境变量(env-example/.env.production.example → .env.local) ==="
|
||||
cp -f env-example/.env.production.example .env.local
|
||||
|
||||
echo "=== 执行构建部署脚本 ==="
|
||||
./scripts/deploy/deploy_web.sh
|
||||
|
||||
|
||||
Reference in New Issue
Block a user