feat: improve error handling in release creation step of CI workflow
CI / Windows x64 (push) Failing after 8m26s

This commit is contained in:
2026-08-02 18:56:49 +07:00
parent 6dd019b3bb
commit 76a22e93fb
+15 -6
View File
@@ -142,15 +142,24 @@ jobs:
API: ${{ github.server_url }}/api/v1/repos/${{ github.repository }}
TAG: ${{ github.ref_name }}
run: |
# pipefail is required: without it a failing curl would be masked by
# a successful jq, id would become null, and the assets would be
# uploaded to a release that does not exist.
# Keep this POSIX: the runner executes steps with dash, where
# `set -o pipefail` does not exist. So the curl call is kept out of a
# pipeline — under `set -e` a failed command substitution aborts the
# step, which is what pipefail would have bought us. Without that, a
# failing curl would be masked by a successful jq, id would become
# null, and assets would be uploaded to a release that never existed.
# No -x here: the command carries the token.
set -euo pipefail
id=$(curl -fsS -X POST "$API/releases" \
set -eu
response=$(curl -fsS -X POST "$API/releases" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\"}" | jq -r .id)
-d "{\"tag_name\":\"$TAG\",\"name\":\"$TAG\"}")
id=$(printf '%s' "$response" | jq -r '.id // empty')
if [ -z "$id" ]; then
echo "no release id in response: $response" >&2
exit 1
fi
echo "release $TAG (id $id)"
for file in dist/*.exe; do