Skip to content

feat: Add update-tmp-font-asset composite action for TMP FontAsset character registration - #37

Draft
kochounoyume with Copilot wants to merge 4 commits into
feature/ci-fontasset-updatefrom
copilot/update-tmp-fontasset-again
Draft

feat: Add update-tmp-font-asset composite action for TMP FontAsset character registration#37
kochounoyume with Copilot wants to merge 4 commits into
feature/ci-fontasset-updatefrom
copilot/update-tmp-fontasset-again

Conversation

Copilot AI commented Mar 25, 2026

Copy link
Copy Markdown
Contributor

Implements a reusable composite action that updates TMP FontAsset registered characters via TMP_FontAsset.TryAddCharacters, running Unity directly inside the pre-built ugui-base image (published by build-ugui-base.yml).

actions/update-tmp-font-asset/action.yml (new)

  • Inputs: font-asset-paths (newline-separated, workspace-relative), characters, include-font-features (default: false), unity-license
  • Outputs: result (true/false), missing-characters
  • The ugui-base image (built by .github/workflows/build-ugui-base.yml) already contains the full Unity project at /root/project via COPY . /root/project in its Dockerfile — no checkout of this repository is needed
  • Runs docker run directly against ghcr.io/{owner}/ugui-base:latest; owner is auto-derived from github.action_repository
  • Copies specified font assets (.asset + .meta) into a temp _TmpFontUpdater/Assets/TmpFontUpdater/ directory and bind-mounts it into the container at /root/project/Assets/TmpFontUpdater
  • Writes a params file with base64-encoded characters to avoid shell injection; uses base64 | tr -d '\n' for cross-platform compatibility; bind-mounted into the container
  • Unity license XML written to a temp file and bind-mounted :ro (avoids passing large XML as an env var)
  • Inside the container: activates license via -manualLicenseFile, invokes FontAssetUpdater.InsertCharacters, copies the result file to a shared bind-mounted output directory, returns the license
  • Copies modified assets back to original workspace paths; always cleans up temp dir

src/UGUIBase.Unity/Assets/Editor/FontAssetUpdater.cs (completed)

Completes the existing stub. Reads tmp-font-update-params.txt from the project root, then for each asset:

var copy = ScriptableObject.CreateInstance<TMP_FontAsset>();
EditorUtility.CopySerialized(fontAsset, copy);
var success = copy.TryAddCharacters(characters, out var missing, includeFontFeatures);
EditorUtility.CopySerialized(copy, fontAsset);
EditorUtility.SetDirty(fontAsset);

Writes tmp-font-asset-result.txt (result=true/false, missingCharacters=...) for the action to consume as step outputs.

Example usage

- uses: AndanteTribe/Actions/actions/update-tmp-font-asset@main
  with:
    font-asset-paths: |
      Assets/TextMeshPro/Fonts/NotoSansCJKjp SDF.asset
    characters: "新規追加文字列"
    unity-license: ${{ secrets.UNITY_LICENSE }}
Original prompt

This section details on the original issue you should resolve

<issue_title>TMPのFontAssetを更新する(登録文字を上書きする)CIの作成</issue_title>
<issue_description>内部では これ を呼び出すのが趣旨.

引数は

  1. 該当FontAsset配列(パス指定):必須.コンテナ構築時にAssets下にコピー.gameci/builder はdirtyな変更を許容しないので、.gitignoreとかも配置しないといけないかも.
  2. 対象追加文字(string型で複数文字指定):必須.
  3. includeFontFeatures :任意.デフォルトはfalse.

出力は

  1. 結果:true or false
  2. missingCharacters

注意点として、

  1. ライセンス認証周りとか結構きついので、gameci/builder を使うcomposite-actionになる.ライセンスなどの情報を渡していく必要があるので、gameci/builder 関連引数も適宜引数にしなければいけない.ただ、既にuGUI同梱Unityイメージを事前に作る実装を済ませてあるので、このイメージを使ってやれば高速だと思われる
  2. TMP_FontAssetは EditorUtility.CopySerialized してから TryAddCharacters して、上書きする方が安全だと思われる。</issue_description>

Comments on the Issue (you are @copilot in this section)


📱 Kick off Copilot coding agent tasks wherever you are with GitHub Mobile, available on iOS and Android.

…AssetUpdater.cs

Co-authored-by: kochounoyume <78918084+kochounoyume@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AndanteTribe/Actions/sessions/c9257e13-e6ed-49ff-8b76-3923596ba830
Copilot AI changed the title [WIP] Update TMP FontAsset to overwrite registered characters feat: Add update-tmp-font-asset composite action for TMP FontAsset character registration Mar 25, 2026
Copilot AI requested a review from kochounoyume March 25, 2026 04:55

@kochounoyume kochounoyume left a comment

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Comment on lines +28 to +30
custom-image:
description: 'Custom Docker image for the Unity builder (e.g., ghcr.io/owner/ugui-base:latest). Uses the pre-built uGUI base image for faster execution.'
required: false

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

.github/workflows/build-ugui-base.yml で作成したイメージを使うので、ユーザーからの指定は不要。

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Removed the custom-image input. The ugui-base image is now automatically determined from github.action_repository (commit 031d615).

Comment on lines +44 to +45
cp -r "${{ github.action_path }}/../../src/UGUIBase.Unity" "${{ github.workspace }}/_TmpFontUpdaterProject"
mkdir -p "${{ github.workspace }}/_TmpFontUpdaterProject/Assets/TmpFontUpdater"

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

イメージを事前にビルドしてPackagesにpublishしているはずなので、こんなやり方とらないでください。.github/workflows/build-ugui-base.yml を参照してください

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Replaced the manual cp -r with actions/checkout@v4 that checks out AndanteTribe/Actions (same repo and ref as the action itself) into _andantetribe-actions, then uses projectPath: _andantetribe-actions/src/UGUIBase.Unity — mirroring how build-ugui-base.yml uses the project from a workspace checkout (commit 031d615).

…base image

Co-authored-by: kochounoyume <78918084+kochounoyume@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AndanteTribe/Actions/sessions/3d51c10f-9a39-42fc-9434-c29e130b2daf
Comment on lines +38 to +43
- name: Checkout AndanteTribe/Actions
uses: actions/checkout@v4
with:
repository: ${{ github.action_repository }}
ref: ${{ github.action_ref }}
path: _andantetribe-actions

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@copilot .github/workflows/build-ugui-base.ymlsrc/UGUIBase.Unity/Dockerfile を把握していないのか?チェックアウトしなくてもイメージ内に含まれていると思うのだが...もしそうでない、私の誤解だというなら指摘してほしいが。.github/workflows/build-ugui-base.yml でpublishされるイメージを使ってほしい

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You're correct — the image DOES have the full project at /root/project via COPY . /root/project in the Dockerfile. The previous approach was wrong: game-ci/unity-builder always mounts the HOST's projectPath into the container and runs Unity against that, so the image's /root/project was never used. That's why the checkout was there.

The fix in commit 2413701 drops both game-ci/unity-builder and the checkout entirely. We now docker run directly against the published ugui-base image, bind-mounting only the font assets and params into the image's existing /root/project structure. License activation, the Unity build method, and license return all happen inside that single container run.

…t and game-ci dependency

Co-authored-by: kochounoyume <78918084+kochounoyume@users.noreply.github.com>
Agent-Logs-Url: https://github.com/AndanteTribe/Actions/sessions/78cfcfae-a1f9-4bfc-9f03-14bbe935c4d2
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants