Files
harpia/scripts/release-upload.sh
Lucas RayanandClaude Opus 5.5 7146f4f70f
CI / Format and clippy (pull_request) Successful in 33s
CI / Dependency audit (pull_request) Successful in 15s
CI / Tests (Linux) (pull_request) Successful in 1m56s
CI / Docker image (build and smoke test) (pull_request) Successful in 6m10s
chore(release): 1.0.0
Releases attach a standalone CLI for linux-aarch64 and linux-x86_64 built
natively (package-cli.sh/release-upload.sh, as in Sabiá). ROADMAP drops the
reference to the local-only spec and README describes the published image
and binaries.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
2026-11-03 10:17:22 -03:00

26 lines
985 B
Bash
Executable File

#!/usr/bin/env bash
# Uploads assets to a Gitea release, replacing any existing asset with the same
# filename so re-running a CI job never fails on duplicate attachments.
#
# API=https://git.example.com/api/v1/repos/owner/repo TOKEN=... \
# scripts/release-upload.sh v1.2.3 file1 file2
set -euo pipefail
: "${API:?set API (Gitea repository API URL)}"
: "${TOKEN:?set TOKEN}"
tag=${1:?usage: release-upload.sh <tag> <file>...}
shift
auth=(-H "Authorization: token $TOKEN")
id=$(curl -fsS "${auth[@]}" "$API/releases/tags/$tag" | jq -r .id)
for file in "$@"; do
name=$(basename "$file")
encoded=$(jq -rn --arg n "$name" '$n|@uri')
for old in $(curl -fsS "${auth[@]}" "$API/releases/$id/assets" | jq -r --arg n "$name" '.[] | select(.name == $n) | .id'); do
curl -fsS -X DELETE "${auth[@]}" "$API/releases/$id/assets/$old"
done
curl -fsS -X POST "${auth[@]}" -F "attachment=@$file" "$API/releases/$id/assets?name=$encoded" >/dev/null
echo "uploaded: $name"
done