Fix ISO upload: use internal Gitea URL to bypass traefik timeout, add curl retries and 30min timeout
Tests / tests (push) Successful in 2m26s

This commit is contained in:
2026-09-15 22:53:24 +10:00
parent 10198915a1
commit 75bc4b3f4c
+17 -13
View File
@@ -55,27 +55,31 @@ jobs:
env: env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
SERVER_URL: ${{ github.server_url }} SERVER_URL: ${{ github.server_url }}
# Use internal Gitea URL to bypass traefik proxy timeout on large uploads
GITEA_API: http://192.168.1.168:3000/api/v1
REPOSITORY: ${{ github.repository }} REPOSITORY: ${{ github.repository }}
TAG_NAME: ${{ steps.tag.outputs.tag_name }} TAG_NAME: ${{ steps.tag.outputs.tag_name }}
RELEASE_NAME: ${{ steps.tag.outputs.release_name }} RELEASE_NAME: ${{ steps.tag.outputs.release_name }}
run: | run: |
# Create the release via Gitea API # Create the release via Gitea API (internal, no traefik)
RELEASE_ID=$(curl -s -X POST \ RELEASE_ID=$(curl -sf -X POST \
-H "Authorization: token $GITEA_TOKEN" \ -H "Authorization: token $GITEA_TOKEN" \
-H "Content-Type: application/json" \ -H "Content-Type: application/json" \
"$SERVER_URL/api/v1/repos/$REPOSITORY/releases" \ "$GITEA_API/repos/$REPOSITORY/releases" \
-d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"$RELEASE_NAME\"}" \ -d "{\"tag_name\": \"$TAG_NAME\", \"name\": \"$RELEASE_NAME\"}" \
| jq -r '.id') | jq -r '.id')
echo "Created release ID: $RELEASE_ID" echo "Created release ID: $RELEASE_ID"
# Upload each ISO as a release asset # Upload each ISO as a release asset (internal, no traefik)
for iso in out/*.iso; do for iso in out/*.iso; do
echo "Uploading $iso..." echo "Uploading $iso ($(du -h "$iso" | cut -f1))..."
curl -s -X POST \ curl -sf --retry 3 --retry-delay 10 \
--max-time 1800 \
-H "Authorization: token $GITEA_TOKEN" \ -H "Authorization: token $GITEA_TOKEN" \
-F "attachment=@$iso" \ -F "attachment=@$iso" \
"$SERVER_URL/api/v1/repos/$REPOSITORY/releases/$RELEASE_ID/assets" "$GITEA_API/repos/$REPOSITORY/releases/$RELEASE_ID/assets"
echo "Upload complete: $iso"
done done
echo "Release $TAG_NAME created and ISOs uploaded." echo "Release $TAG_NAME created and ISOs uploaded."
@@ -83,18 +87,18 @@ jobs:
- name: Keep only latest 3 releases - name: Keep only latest 3 releases
env: env:
GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }} GITEA_TOKEN: ${{ secrets.GITEA_TOKEN }}
SERVER_URL: ${{ github.server_url }} GITEA_API: http://192.168.1.168:3000/api/v1
REPOSITORY: ${{ github.repository }} REPOSITORY: ${{ github.repository }}
run: | run: |
# Fetch all releases # Fetch all releases
releases=$(curl -s -H "Authorization: token $GITEA_TOKEN" \ releases=$(curl -sf -H "Authorization: token $GITEA_TOKEN" \
"$SERVER_URL/api/v1/repos/$REPOSITORY/releases") "$GITEA_API/repos/$REPOSITORY/releases")
# Sort by creation date and delete old ones, keeping only the 3 newest releases # Sort by creation date and delete old ones, keeping only the 3 newest releases
echo "$releases" | jq -r 'sort_by(.created_at) | .[].id' | head -n -3 | while read -r id; do echo "$releases" | jq -r 'sort_by(.created_at) | .[].id' | head -n -3 | while read -r id; do
if [ -n "$id" ]; then if [ -n "$id" ]; then
echo "Deleting old release ID: $id" echo "Deleting old release ID: $id"
curl -s -X DELETE -H "Authorization: token $GITEA_TOKEN" \ curl -sf -X DELETE -H "Authorization: token $GITEA_TOKEN" \
"$SERVER_URL/api/v1/repos/$REPOSITORY/releases/$id" "$GITEA_API/repos/$REPOSITORY/releases/$id"
fi fi
done done