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
+41
View File
@@ -0,0 +1,41 @@
name: ci
on:
push:
branches: [main]
pull_request:
workflow_dispatch:
jobs:
build:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v4
- uses: cachix/install-nix-action@v27
with:
extra_nix_config: |
experimental-features = nix-command flakes
# Builds the cdylib and runs the cargo tests (doCheck).
- name: Build Rust core
run: nix build .#aac --print-build-logs
# Rehearses the VPM release: stages the C# package, bundles libaac, updates vpm/index.json.
- name: Package VPM zip
run: nix develop -c ./vpm/package.sh
# The Unity bundle produced by the flake itself.
- name: Build Unity bundle
run: nix build .#default --print-build-logs
- name: Collect artifacts
run: |
mkdir -p dist
cp -L result dist/animator-as-crab-bundle.zip
cp vpm/dist/*.zip dist/
- uses: actions/upload-artifact@v3
with:
name: animator-as-crab
path: dist/*.zip
+67
View File
@@ -0,0 +1,67 @@
name: release
on:
push:
tags: ['v*']
workflow_dispatch:
jobs:
release:
runs-on: ubuntu-latest
permissions:
contents: write
steps:
- uses: actions/checkout@v4
with:
fetch-depth: 0
- uses: cachix/install-nix-action@v27
with:
extra_nix_config: |
experimental-features = nix-command flakes
# package.sh globs $root/result/lib/*, so the aac package must be linked as ./result.
- name: Build native library
run: nix build .#aac --print-build-logs
- name: Package VPM zip
run: nix develop -c ./vpm/package.sh
- name: Publish release and upload zip
env:
TOKEN: ${{ secrets.VPM_TOKEN || secrets.GITHUB_TOKEN }}
SERVER: ${{ github.server_url }}
REPO: ${{ github.repository }}
TAG: ${{ github.ref_name }}
run: |
set -euo pipefail
manifest=csharp/dev.doloro.animator-as-crab/package.json
id=$(jq -r .name "$manifest")
version=$(jq -r .version "$manifest")
zip="vpm/dist/$id-$version.zip"
release=$(curl -fsS -X POST \
-H "Authorization: token $TOKEN" -H "Content-Type: application/json" \
"$SERVER/api/v1/repos/$REPO/releases" \
-d "$(jq -n --arg tag "$TAG" --arg name "$id $version" \
'{tag_name: $tag, name: $name, draft: false}')")
curl -fsS -X POST \
-H "Authorization: token $TOKEN" \
"$SERVER/api/v1/repos/$REPO/releases/$(jq -r .id <<<"$release")/assets?name=$(basename "$zip")" \
-F "attachment=@$zip"
# The index ships the zip's sha256, which only exists after packaging, so it is committed here.
- name: Commit updated VPM index
env:
TOKEN: ${{ secrets.VPM_TOKEN || secrets.GITHUB_TOKEN }}
run: |
set -euo pipefail
git config user.name gitea-actions
git config user.email actions@git.scug.io
git add vpm/index.json
git diff --cached --quiet && exit 0
version=$(jq -r .version csharp/dev.doloro.animator-as-crab/package.json)
git commit -m "vpm: index for $version"
git push "https://x-access-token:$TOKEN@${GITHUB_SERVER_URL#https://}/${GITHUB_REPOSITORY}.git" \
HEAD:main