ci: 配置 master 自动验证与服务器部署

This commit is contained in:
2026-10-09 20:42:31 +08:00
parent 57882ff568
commit 2cad6d7533
14 changed files with 504 additions and 9 deletions
+12
View File
@@ -0,0 +1,12 @@
#!/usr/bin/env bash
set -euo pipefail
root="${1:?deployment directory required}"
[[ "$root" == /* && "$root" != / && "$root" != *[!a-zA-Z0-9_/-]* ]] || exit 2
umask 077
mkdir -p "$root/configs"
tmp="$(mktemp "$root/configs/.env.XXXXXX")"
trap 'rm -f "$tmp"' EXIT
cat > "$tmp"
[[ -s "$tmp" ]] || exit 1
# Atomic create-if-absent. Existing configuration and encryption key win.
ln "$tmp" "$root/configs/.env" 2>/dev/null || test -s "$root/configs/.env"