ci: fix release asset upload to use multipart form, handle existing releases
Some checks failed
/ Build App (push) Failing after 1m37s
Some checks failed
/ Build App (push) Failing after 1m37s
This commit is contained in:
parent
692c4834cd
commit
95bb71b60f
1 changed files with 16 additions and 9 deletions
15
.github/workflows/build.yml
vendored
15
.github/workflows/build.yml
vendored
|
|
@ -42,14 +42,22 @@ jobs:
|
|||
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||
TAG: ${{ github.ref_name }}
|
||||
run: |
|
||||
# Reuse existing release if already created (handles re-runs)
|
||||
RESPONSE=$(curl -s \
|
||||
"https://git.mithraic.cloud/api/v1/repos/ad3laid3/sanctum/releases/tags/$TAG" \
|
||||
-H "Authorization: token $GITEA_TOKEN")
|
||||
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
|
||||
|
||||
if [ -z "$RELEASE_ID" ]; then
|
||||
RESPONSE=$(curl -sf -X POST \
|
||||
"https://git.mithraic.cloud/api/v1/repos/ad3laid3/sanctum/releases" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/json" \
|
||||
-d "{\"tag_name\":\"$TAG\",\"name\":\"Sanctum $TAG\",\"draft\":false,\"prerelease\":false}")
|
||||
|
||||
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
|
||||
echo "Created release ID: $RELEASE_ID"
|
||||
fi
|
||||
|
||||
echo "Release ID: $RELEASE_ID"
|
||||
|
||||
find out/make -type f -name "*.zip" | while read FILE; do
|
||||
NAME=$(basename "$FILE")
|
||||
|
|
@ -57,6 +65,5 @@ jobs:
|
|||
curl -sf -X POST \
|
||||
"https://git.mithraic.cloud/api/v1/repos/ad3laid3/sanctum/releases/$RELEASE_ID/assets?name=$NAME" \
|
||||
-H "Authorization: token $GITEA_TOKEN" \
|
||||
-H "Content-Type: application/octet-stream" \
|
||||
--data-binary "@$FILE"
|
||||
-F "attachment=@$FILE"
|
||||
done
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue