1
0

package.sh 1.1 KB

123456789101112131415161718192021222324252627282930313233
  1. #!/usr/bin/env bash
  2. # 本地打包:构建 Release 并把 dll 按游戏根目录结构打成 zip
  3. # 用法:scripts/package.sh
  4. # 前置:本机已安装 SPT 客户端(用 SPT_DIR 指定其根目录)
  5. set -euo pipefail
  6. ROOT="$(cd "$(dirname "${BASH_SOURCE[0]}")/.." && pwd)"
  7. cd "$ROOT"
  8. export DOTNET_ROOT="${DOTNET_ROOT:-$HOME/.dotnet}"
  9. export PATH="$DOTNET_ROOT:$DOTNET_ROOT/tools:$PATH"
  10. VERSION="$(sed -n 's:.*<Version>\(.*\)</Version>.*:\1:p' src/PerformanceScope.Plugin/PerformanceScope.Plugin.csproj | head -1)"
  11. [ -n "$VERSION" ] || { echo "错误:未能从 csproj 读取 Version" >&2; exit 1; }
  12. OUT="artifacts"
  13. STAGE="$OUT/PerformanceScope"
  14. rm -rf "$OUT"
  15. mkdir -p "$STAGE/BepInEx/plugins/PerformanceScope"
  16. dotnet build src/PerformanceScope.Plugin/PerformanceScope.Plugin.csproj -c Release -p:DeployToGame=false
  17. cp "src/PerformanceScope.Plugin/bin/Release/PerformanceScope.dll" \
  18. "$STAGE/BepInEx/plugins/PerformanceScope/"
  19. (
  20. cd "$STAGE"
  21. zip -qr "../PerformanceScope-v${VERSION}.zip" .
  22. )
  23. rm -rf "$STAGE"
  24. echo "已生成 artifacts/PerformanceScope-v${VERSION}.zip"