(fix): workflow

This commit is contained in:
Alois 2026-06-28 22:10:08 +02:00
commit f252724a43

View file

@ -97,17 +97,32 @@ jobs:
ASSET_NAME: ${{ steps.version.outputs.asset_name }} ASSET_NAME: ${{ steps.version.outputs.asset_name }}
DESCRIPTION: ${{ inputs.description }} DESCRIPTION: ${{ inputs.description }}
run: | run: |
nix-shell -p curl jq --run '
set -eu set -eu
HTTP_STATUS=$(nix-shell -p curl --run "curl -s -w \"%{http_code}\" -o release_out.json -H \"Authorization: token $TOKEN\" \"$API/repos/$REPO/releases/tags/$TAG\"") HTTP_STATUS=$(curl -s -w "%{http_code}" -o release_out.json \
-H "Authorization: token $TOKEN" \
"$API/repos/$REPO/releases/tags/$TAG")
if [ "$HTTP_STATUS" = "200" ]; then if [ "$HTTP_STATUS" = "200" ]; then
echo "Release $TAG already exists." echo "Release $TAG already exists."
RELEASE_ID="$(jq -r .id release_out.json)" RELEASE_ID="$(jq -r .id release_out.json)"
else else
echo "Creating release for $TAG" echo "Creating release for $TAG"
RELEASE_JSON="$(nix-shell -p curl --run "curl -f -sS -X POST \"$API/repos/$REPO/releases\" -H \"Authorization: token $TOKEN\" -H \"Content-Type: application/json\" -d \"$(jq -n --arg tag \"$TAG\" --arg name \"$TITLE\" --arg body \"$DESCRIPTION\" --arg target \"$SHA\" --argjson prerelease \"$PRERELEASE\" '{ tag_name: $tag, name: $name, body: $body, target_commitish: $target, draft: false, prerelease: $prerelease }')\"")" RELEASE_JSON="$(curl -f -sS -X POST "$API/repos/$REPO/releases" \
-H "Authorization: token $TOKEN" \
-H "Content-Type: application/json" \
-d "$(jq -n \
--arg tag "$TAG" \
--arg name "$TITLE" \
--arg body "$DESCRIPTION" \
--arg target "$SHA" \
--argjson prerelease "$PRERELEASE" \
'"'"'{ tag_name: $tag, name: $name, body: $body, target_commitish: $target, draft: false, prerelease: $prerelease }'"'"')")"
RELEASE_ID="$(echo "$RELEASE_JSON" | jq -r .id)" RELEASE_ID="$(echo "$RELEASE_JSON" | jq -r .id)"
fi fi
nix-shell -p curl --run "curl -fsS -X POST \"$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$ASSET_NAME\" -H \"Authorization: token $TOKEN\" -F \"attachment=@$ASSET_PATH\"" curl -fsS -X POST "$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$ASSET_NAME" \
-H "Authorization: token $TOKEN" \
-F "attachment=@$ASSET_PATH"
'