Files
av3-animation-as-crab/.gitea/workflows/release.yml
T
doloro a1b81b8eb7
ci / build (push) Canceled after 0s
flake: emit Unity bundle zip; add Gitea Actions CI/release; publish VPM index
- 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
2026-09-19 16:07:43 +01:00

68 lines
2.3 KiB
YAML

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