6 Commits
Author SHA1 Message Date
cneicy 39f6f97707 chore(editor): localize mod framework menus
Publish UPM package / publish (push) Successful in 2s
2026-08-26 12:48:32 +08:00
cneicy 95446018c3 test(host): allow Unity test runner completion 2026-08-26 08:23:06 +08:00
cneicy e91db64d76 ci: mirror Git package dependencies 2026-08-26 07:07:04 +08:00
cneicy a5a7f3329f test: enable standalone host discovery 2026-08-26 06:56:06 +08:00
cneicy e793a0a742 ci: stabilize standalone Unity host 2026-08-26 06:36:36 +08:00
ShrinkSDK Automation 5e9f501c26 ci: fetch immutable release archive 2026-08-26 04:29:39 +08:00
9 changed files with 50 additions and 33 deletions
+26 -18
View File
@@ -15,32 +15,39 @@ jobs:
env:
NODE_AUTH_TOKEN: ${{ secrets.SHRINKSDK_PACKAGE_TOKEN }}
steps:
- name: Install Git
- name: Fetch exact tagged release archive
env:
GITEA_REF: ${{ gitea.ref }}
shell: bash
run: |
set -eu
if ! command -v git >/dev/null 2>&1; then
apt-get update
DEBIAN_FRONTEND=noninteractive apt-get install -y --no-install-recommends git ca-certificates
rm -rf /var/lib/apt/lists/*
fi
tag="${GITEA_REF#refs/tags/}"
case "$tag" in
v[0-9]*) ;;
*) echo "Expected a version tag ref, got: $GITEA_REF" >&2; exit 1 ;;
esac
export SHRINKSDK_ARCHIVE_URL="https://git.crash.work/ShrinkSDK/ShrinkModFramework/archive/${tag}.tar.gz"
node --input-type=module <<'NODE'
import { writeFile } from 'node:fs/promises';
- name: Fetch tagged revision
shell: bash
run: |
set -eu
ref="${{ gitea.sha }}"
test -n "$ref"
git init .
git remote add origin "https://git.crash.work/ShrinkSDK/ShrinkModFramework.git"
git fetch --depth=1 --tags origin "$ref"
git checkout --detach FETCH_HEAD
const response = await fetch(process.env.SHRINKSDK_ARCHIVE_URL);
if (!response.ok) {
throw new Error(`Release archive download failed: ${response.status} ${response.statusText}`);
}
await writeFile('release.tar.gz', new Uint8Array(await response.arrayBuffer()));
NODE
mkdir release
tar -xzf release.tar.gz --strip-components=1 -C release
rm -f release.tar.gz
printf '%s' "$tag" > release/.shrink-sdk-release-tag
- name: Validate immutable release version
shell: bash
run: |
set -eu
tag="$(git describe --exact-match --tags HEAD)"
cd release
tag="$(cat .shrink-sdk-release-tag)"
version="$(node -p "require('./package.json').version")"
test "$tag" = "v$version"
npm pack --dry-run
@@ -50,10 +57,11 @@ jobs:
run: |
set -eu
: "${NODE_AUTH_TOKEN:?SHRINKSDK_PACKAGE_TOKEN is required}"
cd release
npmrc="$HOME/.npmrc"
cleanup() { rm -f "$npmrc"; }
trap cleanup EXIT
printf '%s\n' \
'registry=https://git.crash.work/api/packages/ShrinkSDK/npm/' \
'//git.crash.work/api/packages/ShrinkSDK/npm/:_authToken=${NODE_AUTH_TOKEN}' > "$npmrc"
npm publish --registry=https://git.crash.work/api/packages/ShrinkSDK/npm/
npm publish --registry=https://git.crash.work/api/packages/ShrinkSDK/npm/
+6 -1
View File
@@ -26,12 +26,17 @@ jobs:
shell: bash
run: |
set -eu
machine_id_file="/root/.local/share/unity3d/Unity/.machine-id"
if test -s "$machine_id_file"; then
cat "$machine_id_file" > /etc/machine-id
echo "Unity machine identity restored"
fi
git config --global url."https://ghfast.top/https://github.com/".insteadOf "https://github.com/"
unity_bin="$(command -v unity-editor || command -v unity || command -v Unity || true)"
test -n "$unity_bin"
"$unity_bin" \
-batchmode \
-nographics \
-quit \
-projectPath "$PWD/Development~/UnityProject" \
-runTests \
-testPlatform EditMode \
@@ -10,6 +10,10 @@
],
"dependencies": {
"com.unity.test-framework": "1.1.33",
"com.cneicy.shrink-mod-framework": "file:../../.."
}
"com.cneicy.shrink-mod-framework": "file:../../..",
"com.cysharp.unitask": "https://github.com/Cysharp/UniTask.git?path=src/UniTask/Assets/Plugins/UniTask#7c0f199fe0d3fc528024488ccd671e6c7b27745b"
},
"testables": [
"com.cneicy.shrink-mod-framework"
]
}
@@ -11,7 +11,7 @@ using UnityEngine;
public static class ShrinkExternalModTemplateGenerator
{
private const string GenerateMenuPath = "ShrinkSDK/Mod/生成外部模组模板";
private const string GenerateMenuPath = "ShrinkSDK/模组/生成外部模板";
private const string TemplateRelativePath = "Assets/Modules/ShrinkModFramework/Editor/Scaffolding/ExternalModProjectTemplate";
private const string DefaultGeneratedModsRelativePath = "GeneratedMods";
private const string TemplateStampFileName = ".shrink-mod-template.json";
@@ -10,7 +10,7 @@ using UnityEngine;
public static class ShrinkInRepoModTemplateGenerator
{
private const string GenerateMenuPath = "ShrinkSDK/Mod/生成仓库内模组模板(推荐)";
private const string GenerateMenuPath = "ShrinkSDK/模组/生成仓库内模板(推荐";
private const string TemplateRelativePath = "Assets/Modules/ShrinkModFramework/Editor/Scaffolding/InRepoModTemplate";
private const string DefaultOutputRootRelativePath = "Assets/GeneratedMods";
private const string TemplateStampFileName = ".shrink-inrepo-mod-template.json";
+1 -1
View File
@@ -11,7 +11,7 @@ using UnityEngine;
public static class ShrinkModSdkExporter
{
private const string ExportMenuPath = "ShrinkSDK/Mod/导出 Mod SDK 开发包";
private const string ExportMenuPath = "ShrinkSDK/模组/导出开发包";
private const string DefaultOutputRootRelativePath = "GeneratedModSdk";
private const string StampFileName = ".shrink-mod-sdk.json";
private const string TemplateProjectName = "SampleShrinkMod";
+7 -7
View File
@@ -220,7 +220,7 @@ var snapshot = ShrinkModDiagnostics.CaptureExternalAssemblies(settings);
快照包含当前与历史 revision、来源路径、程序集名、SHA-256 revision、载入字节数、常驻数量和软阈值状态。失败 revision 可以成为已载入的历史程序集,但不会成为 current;达到软阈值只告警,不伪造卸载行为。
导入 `ShrinkContext.AppAdapter` 的 Editor 工具后,也可以从 `ShrinkSDK/Cordis/诊断与组合` 查看同一份常驻快照;该窗口通过可选反射读取,不会让 AppAdapter 对 ModFramework 建立硬依赖。
导入 `ShrinkContext.AppAdapter` 的 Editor 工具后,也可以从 `ShrinkSDK/上下文/诊断与组合` 查看同一份常驻快照;该窗口通过可选反射读取,不会让 AppAdapter 对 ModFramework 建立硬依赖。
## Harmony 热补丁
@@ -574,9 +574,9 @@ public sealed partial class DemoFullMod : ShrinkModBase
现在已经提供和 `ShrinkNetwork` 独立服务器生成器同风格的模组开发入口:
- 菜单:`ShrinkSDK/Mod/导出 Mod SDK 开发包`
- 菜单:`ShrinkSDK/Mod/生成仓库内模组模板(推荐)`
- 菜单:`ShrinkSDK/Mod/生成外部模组模板`
- 菜单:`ShrinkSDK/模组/导出开发包`
- 菜单:`ShrinkSDK/模组/生成仓库内模板(推荐`
- 菜单:`ShrinkSDK/模组/生成外部模板`
更推荐优先用“仓库内模组模板”:
@@ -599,7 +599,7 @@ public sealed partial class DemoFullMod : ShrinkModBase
如果目标是给**外部模组开发者**发 SDK,当前更推荐直接用:
- `ShrinkSDK/Mod/导出 Mod SDK 开发包`
- `ShrinkSDK/模组/导出开发包`
它会导出:
@@ -661,10 +661,10 @@ public sealed partial class DemoFullMod : ShrinkModBase
建议流程:
1. 你自己在当前仓库开发时,优先用 `ShrinkSDK/Mod/生成仓库内模组模板(推荐)`
1. 你自己在当前仓库开发时,优先用 `ShrinkSDK/模组/生成仓库内模板(推荐`
2. 先改 `modId`、命名空间、命令路径、`opcode`
3. 在当前 Unity/IDE 里直接开发和编译
4. 如果要发给外部模组开发者,改用 `ShrinkSDK/Mod/导出 Mod SDK 开发包`
4. 如果要发给外部模组开发者,改用 `ShrinkSDK/模组/导出开发包`
如果你已经知道目标 `Mods` 目录,也可以直接跑模板里的:
@@ -2,7 +2,7 @@ using UnityEngine;
namespace ShrinkModFramework
{
[CreateAssetMenu(fileName = "ShrinkModFrameworkSettings", menuName = "ShrinkModFramework/Settings")]
[CreateAssetMenu(fileName = "ShrinkModFrameworkSettings", menuName = "ShrinkSDK/模组/模组设置")]
public class ShrinkModFrameworkSettings : ScriptableObject
{
private static ShrinkModFrameworkSettings _instance;
+1 -1
View File
@@ -1,6 +1,6 @@
{
"name": "com.cneicy.shrink-mod-framework",
"version": "0.2.1",
"version": "0.2.2",
"displayName": "ShrinkModFramework",
"description": "Unity 模组框架,提供发现、依赖、可逆生命周期、命名空间内容注册与优先级覆盖。",
"unity": "2022.3",