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
25
.github/workflows/build.yml
vendored
25
.github/workflows/build.yml
vendored
|
|
@ -42,14 +42,22 @@ jobs:
|
||||||
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
GITEA_TOKEN: ${{ secrets.GITHUB_TOKEN }}
|
||||||
TAG: ${{ github.ref_name }}
|
TAG: ${{ github.ref_name }}
|
||||||
run: |
|
run: |
|
||||||
RESPONSE=$(curl -sf -X POST \
|
# Reuse existing release if already created (handles re-runs)
|
||||||
"https://git.mithraic.cloud/api/v1/repos/ad3laid3/sanctum/releases" \
|
RESPONSE=$(curl -s \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
"https://git.mithraic.cloud/api/v1/repos/ad3laid3/sanctum/releases/tags/$TAG" \
|
||||||
-H "Content-Type: application/json" \
|
-H "Authorization: token $GITEA_TOKEN")
|
||||||
-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]*')
|
RELEASE_ID=$(echo "$RESPONSE" | grep -o '"id":[0-9]*' | head -1 | grep -o '[0-9]*')
|
||||||
echo "Created release ID: $RELEASE_ID"
|
|
||||||
|
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]*')
|
||||||
|
fi
|
||||||
|
|
||||||
|
echo "Release ID: $RELEASE_ID"
|
||||||
|
|
||||||
find out/make -type f -name "*.zip" | while read FILE; do
|
find out/make -type f -name "*.zip" | while read FILE; do
|
||||||
NAME=$(basename "$FILE")
|
NAME=$(basename "$FILE")
|
||||||
|
|
@ -57,6 +65,5 @@ jobs:
|
||||||
curl -sf -X POST \
|
curl -sf -X POST \
|
||||||
"https://git.mithraic.cloud/api/v1/repos/ad3laid3/sanctum/releases/$RELEASE_ID/assets?name=$NAME" \
|
"https://git.mithraic.cloud/api/v1/repos/ad3laid3/sanctum/releases/$RELEASE_ID/assets?name=$NAME" \
|
||||||
-H "Authorization: token $GITEA_TOKEN" \
|
-H "Authorization: token $GITEA_TOKEN" \
|
||||||
-H "Content-Type: application/octet-stream" \
|
-F "attachment=@$FILE"
|
||||||
--data-binary "@$FILE"
|
|
||||||
done
|
done
|
||||||
|
|
|
||||||
Loading…
Add table
Reference in a new issue