Publish releases with a curl script; the Go-based action cannot run on this runner
ci / check (push) Canceled after 0s
release / release (push) Successful in 26m8s

This commit is contained in:
2026-10-14 23:04:27 +02:00
parent 45ecc698c2
commit 0c5340aca4
2 changed files with 32 additions and 4 deletions
+3 -4
View File
@@ -72,7 +72,6 @@ jobs:
cp src-tauri/target/x86_64-pc-windows-msvc/release/gites.exe "release/gites_${GITHUB_REF_NAME#v}_x64_portable.exe"
ls -la release
- name: Publish release
uses: https://gitea.com/actions/release-action@main
with:
files: release/*
api_key: "${{ secrets.GITHUB_TOKEN }}"
env:
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: scripts/publish-release.sh release/*
+29
View File
@@ -0,0 +1,29 @@
#!/usr/bin/env bash
# Creates the Gitea release for the current tag (or reuses it) and uploads every file
# given as an argument, replacing files of the same name from an earlier run.
# Needs GITEA_TOKEN plus the GITHUB_* variables every Actions job gets.
set -euo pipefail
api="$GITHUB_SERVER_URL/api/v1/repos/$GITHUB_REPOSITORY"
tag="$GITHUB_REF_NAME"
auth=(-H "Authorization: token $GITEA_TOKEN")
json() { node -e "let s='';process.stdin.on('data',d=>s+=d).on('end',()=>{const v=JSON.parse(s);console.log($1)})"; }
if release=$(curl -sf "${auth[@]}" "$api/releases/tags/$tag"); then
echo "Using the existing release for $tag"
else
echo "Creating the release for $tag"
release=$(curl -sf "${auth[@]}" -H "Content-Type: application/json" \
-d "{\"tag_name\": \"$tag\", \"name\": \"$tag\"}" "$api/releases")
fi
id=$(echo "$release" | json 'v.id')
for file in "$@"; do
name=$(basename "$file")
old=$(echo "$release" | NAME="$name" json "(v.assets||[]).filter(a=>a.name===process.env.NAME).map(a=>a.id).join(' ')")
for asset in $old; do
curl -sf "${auth[@]}" -X DELETE "$api/releases/$id/assets/$asset"
done
echo "Uploading $name"
curl -sf "${auth[@]}" -F "attachment=@$file" "$api/releases/$id/assets?name=$name" >/dev/null
done