flake: emit Unity bundle zip; add Gitea Actions CI/release; publish VPM index
ci / build (push) Canceled after 0s

- flake.nix: install the libaac cdylib alongside aac-dump and zip it with
  the C# Unity packages as the default package
- .gitea/workflows: build+package on push/PR, publish release on v* tags
- vpm: commit the repository index and packaging script, with VPM_INDEX and
  VPM_INDEX_URL overrides for generating a local listing
This commit is contained in:
2026-09-19 16:07:43 +01:00
parent 2c3b670ab9
commit a1b81b8eb7
6 changed files with 257 additions and 4 deletions
+30
View File
@@ -0,0 +1,30 @@
{
"name": "Doloro VPM Packages",
"id": "dev.doloro.vpm",
"url": "https://git.scug.io/doloro/av3-animation-as-crab/-/raw/main/vpm/index.json",
"author": {
"name": "doloro"
},
"packages": {
"dev.doloro.animator-as-crab": {
"versions": {
"0.1.0": {
"name": "dev.doloro.animator-as-crab",
"displayName": "Animator As Crab",
"version": "0.1.0",
"unity": "2019.4",
"description": "Writes Animator Controllers from a Rhai script, evaluated by the libaac native library.",
"url": "https://git.scug.io/doloro/av3-animation-as-crab/-/releases/download/v0.1.0/dev.doloro.animator-as-crab-0.1.0.zip",
"zipSHA256": "e0ad8c5717059115567e5c7907425d4a6a1ce1613023197061796d0b5128a515",
"dependencies": {
"com.unity.nuget.newtonsoft-json": "3.2.1"
},
"vpmDependencies": {},
"author": {
"name": "doloro"
}
}
}
}
}
}
Executable
+81
View File
@@ -0,0 +1,81 @@
#!/usr/bin/env bash
# Builds the VPM release zip for dev.doloro.animator-as-crab and (re)generates vpm/index.json,
# the repository listing that VCC and ALCOM read.
#
# Needs `zip` and `jq`: run it inside `nix develop`.
#
# Environment overrides (all optional):
# VPM_HOST default https://git.scug.io
# VPM_PROJECT default doloro/av3-animation-as-crab
# VPM_RELEASE_BASE default <host>/<project>/-/releases/download/v<version>
# VPM_INDEX default <root>/vpm/index.json
# VPM_INDEX_URL default <host>/<project>/-/raw/main/vpm/index.json
# VPM_REPO_NAME default "Doloro VPM Packages"
# VPM_REPO_ID default dev.doloro.vpm
set -euo pipefail
root=$(cd "$(dirname "$0")/.." && pwd)
pkg="$root/csharp/dev.doloro.animator-as-crab"
vpm="$root/vpm"
host=${VPM_HOST:-https://git.scug.io}
project=${VPM_PROJECT:-doloro/av3-animation-as-crab}
repo_name=${VPM_REPO_NAME:-Doloro VPM Packages}
repo_id=${VPM_REPO_ID:-dev.doloro.vpm}
index_url=${VPM_INDEX_URL:-$host/$project/-/raw/main/vpm/index.json}
release_base=${VPM_RELEASE_BASE:-}
id=$(jq -r .name "$pkg/package.json")
version=$(jq -r .version "$pkg/package.json")
zip_name="$id-$version.zip"
: "${release_base:=$host/$project/-/releases/download/v$version}"
zip_url="$release_base/$zip_name"
stage=$(mktemp -d)
trap 'rm -rf "$stage"' EXIT
cp -r "$pkg/." "$stage/"
rm -f "$stage/.gitignore"
# The native library is not optional: DllImport("libaac") fails without it, and a VPM package is
# unpacked into Packages/, so it cannot rely on the user's Assets/Plugins. Ship it in the package.
# Only Linux is built here; drop a libaac.dll / libaac.dylib into vpm/native/ for other hosts.
shopt -s nullglob
native=("$vpm"/native/* "$root"/result/lib/*)
shopt -u nullglob
if [ ${#native[@]} -eq 0 ]; then
echo "warning: no native library found; the package will not load libaac" >&2
fi
for lib in "${native[@]}"; do
cp "$lib" "$stage/V1/Editor/"
echo "bundled $(basename "$lib")"
done
mkdir -p "$vpm/dist"
rm -f "$vpm/dist/$zip_name"
(cd "$stage" && zip -r -X -q "$vpm/dist/$zip_name" .)
sha=$(sha256sum "$vpm/dist/$zip_name" | cut -d' ' -f1)
entry=$(jq -n \
--arg id "$id" --arg version "$version" --arg zip_url "$zip_url" --arg sha "$sha" \
--slurpfile manifest "$pkg/package.json" \
'{name: $id, displayName: $manifest[0].displayName, version: $version, unity: $manifest[0].unity,
description: $manifest[0].description, url: $zip_url, zipSHA256: $sha,
dependencies: ($manifest[0].dependencies // {}), vpmDependencies: {}, author: $manifest[0].author}')
index=${VPM_INDEX:-$vpm/index.json}
old='{}'
[ -f "$index" ] && old=$(cat "$index")
echo "$old" | jq \
--arg repo_name "$repo_name" --arg repo_id "$repo_id" --arg index_url "$index_url" \
--arg id "$id" --arg version "$version" --argjson entry "$entry" \
'.name = $repo_name | .id = $repo_id | .url = $index_url | .author = $entry.author
| .packages = (.packages // {})
| .packages[$id] = (.packages[$id] // {versions: {}})
| .packages[$id].versions[$version] = $entry' > "$index"
jq -e . "$index" > /dev/null
echo "wrote $vpm/dist/$zip_name"
echo "sha256 $sha"
echo "updated $index -> $zip_url"