Skip to content

Commit 1546bd3

Browse files
committed
feat: vpm
1 parent c258f6f commit 1546bd3

24 files changed

Lines changed: 2493 additions & 2170 deletions
Lines changed: 128 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,128 @@
1+
name: Build VPM Repository Listing
2+
3+
on:
4+
push:
5+
branches: [master]
6+
tags: ['*']
7+
workflow_dispatch:
8+
9+
permissions:
10+
contents: write
11+
pages: write
12+
id-token: write
13+
14+
concurrency:
15+
group: "pages"
16+
cancel-in-progress: false
17+
18+
env:
19+
GITHUB_OWNER: ${{ github.repository_owner }}
20+
GITHUB_REPO: ${{ github.event.repository.name }}
21+
22+
jobs:
23+
build-listing:
24+
runs-on: ubuntu-latest
25+
steps:
26+
- name: Checkout
27+
uses: actions/checkout@v4
28+
with:
29+
fetch-depth: 1
30+
31+
- name: Build VPM Listing
32+
run: |
33+
set -e
34+
35+
REPO_URL="https://${GITHUB_OWNER}.github.io/${GITHUB_REPO}"
36+
37+
# 定义所有包的目录(相对于仓库根)
38+
PACKAGE_DIRS=(
39+
"Assets/UnityBox/AdvancedCostumeController"
40+
"Assets/UnityBox/BlendshapeControllerGenerator"
41+
"Assets/UnityBox/AvatarColliderMonitor"
42+
"Assets/UnityBox/BuildPipelineLogger"
43+
)
44+
45+
mkdir -p _site
46+
47+
# 获取当前 tag(如有),否则使用 package.json 中的 version
48+
GIT_TAG="${GITHUB_REF_NAME}"
49+
50+
# 构建每个包的 zip
51+
PACKAGES_JSON="{"
52+
FIRST_PKG=true
53+
54+
for pkg_dir in "${PACKAGE_DIRS[@]}"; do
55+
if [ ! -f "${pkg_dir}/package.json" ]; then
56+
echo "跳过 ${pkg_dir}:未找到 package.json"
57+
continue
58+
fi
59+
60+
PKG_NAME=$(jq -r '.name' "${pkg_dir}/package.json")
61+
PKG_VERSION=$(jq -r '.version' "${pkg_dir}/package.json")
62+
PKG_DISPLAY_NAME=$(jq -r '.displayName' "${pkg_dir}/package.json")
63+
64+
# 如果是 tag 推送,用 tag 作为版本号(去掉前缀 v)
65+
if [[ "${GITHUB_REF}" == refs/tags/* ]]; then
66+
TAG_VERSION="${GIT_TAG#v}"
67+
# 更新 package.json 中的版本号
68+
jq --arg v "$TAG_VERSION" '.version = $v' "${pkg_dir}/package.json" > "${pkg_dir}/package.json.tmp"
69+
mv "${pkg_dir}/package.json.tmp" "${pkg_dir}/package.json"
70+
PKG_VERSION="$TAG_VERSION"
71+
fi
72+
73+
echo "打包: ${PKG_NAME} v${PKG_VERSION}"
74+
75+
# 创建 zip 包
76+
ZIP_NAME="${PKG_NAME}-${PKG_VERSION}.zip"
77+
(cd "${pkg_dir}" && zip -r "../../../_site/${ZIP_NAME}" . -x "*.meta" -x "*/Generated/*")
78+
79+
ZIP_URL="${REPO_URL}/${ZIP_NAME}"
80+
ZIP_SHA256=$(sha256sum "_site/${ZIP_NAME}" | cut -d' ' -f1)
81+
82+
# 读取完整的 package.json 并添加 zipSHA256 和 url
83+
PKG_JSON=$(jq --arg url "$ZIP_URL" --arg sha "$ZIP_SHA256" \
84+
'. + {"zipSHA256": $sha, "url": $url}' "${pkg_dir}/package.json")
85+
86+
# 构建 packages 对象
87+
if [ "$FIRST_PKG" = true ]; then
88+
FIRST_PKG=false
89+
else
90+
PACKAGES_JSON="${PACKAGES_JSON},"
91+
fi
92+
PACKAGES_JSON="${PACKAGES_JSON}\"${PKG_NAME}\":{\"versions\":{\"${PKG_VERSION}\":${PKG_JSON}}}"
93+
done
94+
95+
PACKAGES_JSON="${PACKAGES_JSON}}"
96+
97+
# 构建最终的 VPM listing vpm.json
98+
cat > _site/vpm.json <<LISTING_EOF
99+
{
100+
"name": "UnityBox",
101+
"id": "top.sealoong.unitybox.listing",
102+
"url": "${REPO_URL}/vpm.json",
103+
"author": "SeaLoong",
104+
"packages": ${PACKAGES_JSON}
105+
}
106+
LISTING_EOF
107+
108+
# 使用 jq 格式化
109+
jq '.' _site/vpm.json > _site/vpm.json.tmp && mv _site/vpm.json.tmp _site/vpm.json
110+
111+
echo "VPM listing 已构建完成"
112+
cat _site/vpm.json
113+
114+
- name: Upload Pages artifact
115+
uses: actions/upload-pages-artifact@v3
116+
with:
117+
path: _site
118+
119+
deploy:
120+
needs: build-listing
121+
runs-on: ubuntu-latest
122+
environment:
123+
name: github-pages
124+
url: ${{ steps.deployment.outputs.page_url }}
125+
steps:
126+
- name: Deploy to GitHub Pages
127+
id: deployment
128+
uses: actions/deploy-pages@v4

.gitignore

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -4,10 +4,8 @@
44
#
55

66
/[Aa]ssets/*
7-
!/[Aa]ssets/SeaLoong's UnityBox/
8-
/[Aa]ssets/SeaLoong's UnityBox/*
9-
!/[Aa]ssets/SeaLoong's UnityBox/Editor/
10-
!/[Aa]ssets/SeaLoong's UnityBox/Editor/**
7+
!/[Aa]ssets/UnityBox/
8+
!/[Aa]ssets/csc.rsp
119

1210

1311
.utmp/
@@ -115,3 +113,5 @@ InitTestScene*.unity*
115113

116114
*.unity
117115
/[Aa]ssets/*.unity
116+
117+
**/Generated/

Assets/SeaLoong's UnityBox/Editor/SeaLoong.asmdef

Lines changed: 0 additions & 41 deletions
This file was deleted.

Assets/SeaLoong's UnityBox/Editor/AdvancedCostumeController/AnimationBuilder.cs renamed to Assets/UnityBox/AdvancedCostumeController/Editor/AnimationBuilder.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using UnityEditor.Animations;
66
using UnityEngine;
77

8-
namespace SeaLoongUnityBox.ACC
8+
namespace UnityBox.AdvancedCostumeController
99
{
1010
/// <summary>
1111
/// 动画构建器 — 负责创建所有 AnimationClip 和 AnimatorController 结构

Assets/SeaLoong's UnityBox/Editor/AdvancedCostumeController/Generator.cs renamed to Assets/UnityBox/AdvancedCostumeController/Editor/Generator.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
using nadena.dev.modular_avatar.core;
88
using VRC.SDK3.Avatars.Components;
99

10-
namespace SeaLoongUnityBox.ACC
10+
namespace UnityBox.AdvancedCostumeController
1111
{
1212
/// <summary>
1313
/// 生成器 — 负责菜单构建和整体生成流程的协调

Assets/SeaLoong's UnityBox/Editor/AdvancedCostumeController/Mixer.cs renamed to Assets/UnityBox/AdvancedCostumeController/Editor/Mixer.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
using UnityEngine;
66
using nadena.dev.modular_avatar.core;
77

8-
namespace SeaLoongUnityBox.ACC
8+
namespace UnityBox.AdvancedCostumeController
99
{
1010
/// <summary>
1111
/// 混搭器 — 负责 CustomMixer 的菜单构建和参数注册

Assets/SeaLoong's UnityBox/Editor/AdvancedCostumeController/Models.cs renamed to Assets/UnityBox/AdvancedCostumeController/Editor/Models.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections.Generic;
22
using UnityEngine;
33

4-
namespace SeaLoongUnityBox.ACC
4+
namespace UnityBox.AdvancedCostumeController
55
{
66
/// <summary>
77
/// 服装数据结构 — 描述一套服装的所有信息
@@ -53,7 +53,7 @@ public class ACCConfig
5353
public GameObject CostumesRoot;
5454
public string ParamPrefix = "CST";
5555
public string CostumeParamName = "costume";
56-
public string GeneratedFolder = "Assets/SeaLoong's UnityBox/Advanced Costume Controller/Generated";
56+
public string GeneratedFolder = "Assets/UnityBox/AdvancedCostumeController/Generated";
5757
public string IgnoreNamesCsv = "Armature,Bone,Skeleton";
5858
public GameObject DefaultOutfitOverride;
5959
public bool EnableParts = false;

Assets/SeaLoong's UnityBox/Editor/AdvancedCostumeController/Scanner.cs renamed to Assets/UnityBox/AdvancedCostumeController/Editor/Scanner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
using System.Collections.Generic;
22
using UnityEngine;
33

4-
namespace SeaLoongUnityBox.ACC
4+
namespace UnityBox.AdvancedCostumeController
55
{
66
/// <summary>
77
/// 服装扫描器 — 从 CostumesRoot 层级结构中自动发现服装、变体和部件
Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,29 @@
1+
{
2+
"name": "UnityBox.AdvancedCostumeController",
3+
"rootNamespace": "UnityBox.AdvancedCostumeController",
4+
"references": [
5+
"VRC.SDK3A",
6+
"VRC.SDK3A.Editor",
7+
"VRC.SDKBase",
8+
"VRC.SDKBase.Editor",
9+
"nadena.dev.modular-avatar.core",
10+
"nadena.dev.modular-avatar.core.editor"
11+
],
12+
"includePlatforms": [
13+
"Editor"
14+
],
15+
"excludePlatforms": [],
16+
"allowUnsafeCode": false,
17+
"overrideReferences": false,
18+
"precompiledReferences": [],
19+
"autoReferenced": true,
20+
"defineConstraints": [],
21+
"versionDefines": [
22+
{
23+
"name": "nadena.dev.modular-avatar",
24+
"expression": "",
25+
"define": "MODULAR_AVATAR_AVAILABLE"
26+
}
27+
],
28+
"noEngineReferences": false
29+
}

0 commit comments

Comments
 (0)