The updater reads the latest release from Gitea. update::apply refuses to overwrite anything but the CLI. Release workflow builds the Linux CLI; scripts/build-gui.sh builds the Linux and Windows desktop app. Docs say Linux and Windows only. Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
25 lines
945 B
Bash
Executable File
25 lines
945 B
Bash
Executable File
#!/usr/bin/env bash
|
|
# Anexa arquivos a uma release do Gitea, trocando os de mesmo nome (assim uma
|
|
# execução repetida do CI não falha por anexo duplicado).
|
|
#
|
|
# API=https://git.exemplo.com/api/v1/repos/dono/repo TOKEN=... \
|
|
# scripts/release-upload.sh v1.2.3 arquivo1 arquivo2
|
|
set -euo pipefail
|
|
|
|
: "${API:?defina API (URL do repositório na API do Gitea)}"
|
|
: "${TOKEN:?defina TOKEN}"
|
|
tag=${1:?uso: release-upload.sh <tag> <arquivo>...}
|
|
shift
|
|
|
|
auth=(-H "Authorization: token $TOKEN")
|
|
id=$(curl -fsS "${auth[@]}" "$API/releases/tags/$tag" | jq -r .id)
|
|
|
|
for file in "$@"; do
|
|
name=$(basename "$file")
|
|
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=$name" >/dev/null
|
|
echo "enviado: $name"
|
|
done
|