Skip to content

Commit 8efdfd1

Browse files
committed
fix: Bedre output og feilhåndtering sånn at vi kan laste opp de resterende filene.
1 parent 7c8f5e9 commit 8efdfd1

File tree

1 file changed

+8
-4
lines changed

1 file changed

+8
-4
lines changed

.github/workflows/buildAndPublish.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -204,11 +204,9 @@ jobs:
204204
--argjson body "$body" \
205205
'{tag_name: $tag, name: $name, body: $body}')
206206
207-
# Debug: Output the JSON payload
208207
echo "JSON Payload:"
209208
echo "$json_payload"
210209
211-
# Send the API request
212210
response=$(curl -s -w "\n%{http_code}" \
213211
-H "Accept: application/vnd.github.v3+json" \
214212
-H "Authorization: token ${NODE_AUTH_TOKEN}" \
@@ -228,7 +226,6 @@ jobs:
228226
exit 1
229227
fi
230228
231-
# Extract upload_url and remove any trailing template parameters
232229
UPLOAD_URL=$(echo "$body" | jq -r '.upload_url | sub("\\{.*$"; "") // ""')
233230
if [ -z "$UPLOAD_URL" ]; then
234231
echo "${red}Failed to extract upload_url from response${reset}"
@@ -243,6 +240,10 @@ jobs:
243240
failure_count=0
244241
max_retries=2
245242
243+
# Debug: List files to upload
244+
echo "Files to upload:"
245+
ls -l releases/${RELEASE_NAME}/
246+
246247
for file in releases/${RELEASE_NAME}/*; do
247248
if [ -f "$file" ]; then
248249
filename=$(basename "$file")
@@ -251,11 +252,12 @@ jobs:
251252
success=false
252253
253254
while [ $attempt -lt $max_retries ] && [ "$success" = false ]; do
255+
# Run curl with explicit error handling
254256
upload_response=$(curl -s -w "\n%{http_code}" \
255257
-H "Authorization: token ${NODE_AUTH_TOKEN}" \
256258
-H "Content-Type: application/octet-stream" \
257259
--data-binary @"$file" \
258-
"$UPLOAD_URL?name=$filename")
260+
"$UPLOAD_URL?name=$filename" || echo "curl failed with exit code $?"; echo "999")
259261
upload_status=$(echo "$upload_response" | tail -n1)
260262
upload_body=$(echo "$upload_response" | sed '$d')
261263
@@ -275,6 +277,8 @@ jobs:
275277
echo "::warning::Failed to upload $filename after $max_retries attempts"
276278
((failure_count++))
277279
fi
280+
else
281+
echo "Skipping $file - not a regular file"
278282
fi
279283
done
280284
echo "::endgroup::"

0 commit comments

Comments
 (0)