Skip to content

Commit f186160

Browse files
committed
fix: forsøker å få kontroll på exit statusen for å kunne se hva som skjer
1 parent 89b1674 commit f186160

File tree

1 file changed

+6
-6
lines changed

1 file changed

+6
-6
lines changed

.github/workflows/buildAndPublish.yml

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -180,6 +180,7 @@ jobs:
180180

181181
- name: Create Github Release
182182
if: steps.build.outputs.artifactsFound == 'true'
183+
shell: bash {0} # Use bash without -e to respect set +e
183184
run: |
184185
set +e # Disable exit-on-error to allow custom error handling
185186
printf -v red '\033[0;31m'
@@ -250,22 +251,22 @@ jobs:
250251
success=false
251252
252253
while [ $attempt -lt $max_retries ] && [ "$success" = false ]; do
253-
# Explicitly capture curl output and status, even on failure
254-
set +e # Ensure curl failure doesn't exit the script
254+
echo "Attempt $((attempt + 1)) for $filename"
255255
upload_response=$(curl -s -w "\n%{http_code}" \
256256
-H "Authorization: token ${NODE_AUTH_TOKEN}" \
257257
-H "Content-Type: application/octet-stream" \
258258
--data-binary @"$file" \
259259
"$UPLOAD_URL?name=$filename")
260260
curl_exit_code=$?
261-
set -e # Re-enable if needed after curl
262-
263261
upload_status=$(echo "$upload_response" | tail -n1)
264262
upload_body=$(echo "$upload_response" | sed '$d')
265263
264+
echo "curl exit code: $curl_exit_code"
265+
echo "Upload status: $upload_status"
266+
echo "Upload body: $upload_body"
267+
266268
if [ $curl_exit_code -ne 0 ]; then
267269
echo "${red}curl command failed with exit code $curl_exit_code${reset}"
268-
echo "Upload Response: $upload_response"
269270
((attempt++))
270271
[ $attempt -lt $max_retries ] && sleep 2
271272
elif [ "$upload_status" -eq 201 ]; then
@@ -274,7 +275,6 @@ jobs:
274275
((success_count++))
275276
else
276277
echo "${red}Upload attempt $attempt failed for $filename (HTTP $upload_status)${reset}"
277-
echo "Upload Response: $upload_body"
278278
((attempt++))
279279
[ $attempt -lt $max_retries ] && sleep 2
280280
fi

0 commit comments

Comments
 (0)