How to build AssetBundles for headless server by using Scriptable Build Pipeline?

Hi. Current Unity supports building headless server target, which strips any needless assets in headless mode (like texture, mesh data).

So my question is, how to build AssetBundle for headless build by using SBP. (or, not supported yet?)

Thanks.

This example would export whatever is selected as an asset bundle

string assetBundleDirectory = Path.Combine(Application.streamingAssetsPath, "myassetBundle");
AssetBundleBuild[ ] AssetMap = new UnityEditor.AssetBundleBuild[1];
AssetMap[0].assetBundleName = "item";
string path = AssetDatabase.GetAssetPath(Selection.activeObject);
string[ ] paths = new string[1];
paths[0] = path;
AssetMap[0].assetNames = paths;
//Debug.Log("prefabPath " + path);

UnityEditor.BuildPipeline.BuildAssetBundles(assetBundleDirectory,
AssetMap,
UnityEditor.BuildAssetBundleOptions.None,
UnityEditor.BuildTarget.StandaloneWindows);

Loading looks like this

string path = Path.Combine(Application.streamingAssetsPath, "myassetBundle/item");

Debug.Log("path " + path);
var myLoadedAssetBundle
= AssetBundle.LoadFromFile(path);

if (myLoadedAssetBundle == null)
{
Debug.Log("Failed to load AssetBundle!");
return;
}
var prefab = myLoadedAssetBundle.LoadAsset("item") as GameObject;
Instantiate(prefab);

@AnthonyRUnity Thanks for reply. But your post seems that building for StandaloneWindows, not for dedicated server.

This document describes about legacy assetbundle build pipeline, and I’m searching for its ScriptableBuildPipeline equivalent.

Here is my latest related post:
https://forum.unity.com/threads/missing-subtarget-property-in-scriptablebuildpipeline.1451782/