ci / Nix flake checks (push) Failing after 1h6m15s
- run on the 'nix' label with Nix preinstalled; drop the installer action - replace the inline release API calls with vpm/publish.sh - add curl to the devShell for the publish step
36 lines
1.2 KiB
Bash
Executable File
36 lines
1.2 KiB
Bash
Executable File
#!/usr/bin/env bash
|
|
# Creates the Gitea release for the current tag and attaches the VPM zip built by package.sh.
|
|
#
|
|
# Needs `curl` and `jq`: run it inside `nix develop`.
|
|
#
|
|
# Environment:
|
|
# TOKEN required, Gitea token with repository write access
|
|
# SERVER required, e.g. https://git.scug.io
|
|
# REPO required, e.g. doloro/av3-animation-as-crab
|
|
# TAG required, release tag
|
|
set -euo pipefail
|
|
|
|
root=$(cd "$(dirname "$0")/.." && pwd)
|
|
manifest="$root/csharp/dev.doloro.animator-as-crab/package.json"
|
|
|
|
id=$(jq -r .name "$manifest")
|
|
version=$(jq -r .version "$manifest")
|
|
zip="$root/vpm/dist/$id-$version.zip"
|
|
|
|
zip_name=$(basename "$zip")
|
|
[ -f "$zip" ] || { echo "missing $zip; run package.sh first" >&2; exit 1; }
|
|
|
|
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}')")
|
|
|
|
asset_url="$SERVER/api/v1/repos/$REPO/releases/$(jq -r .id <<<"$release")/assets?name=$zip_name"
|
|
|
|
curl -fsS -X POST \
|
|
-H "Authorization: token $TOKEN" \
|
|
"$asset_url" \
|
|
-F "attachment=@$zip"
|
|
|
|
echo "released $TAG with $zip_name"
|