(fix): workflow
This commit is contained in:
parent
af96da10a9
commit
cf6201fe18
1 changed files with 3 additions and 21 deletions
|
|
@ -99,33 +99,15 @@ jobs:
|
|||
run: |
|
||||
set -eu
|
||||
|
||||
HTTP_STATUS=$(curl -s -w "%{http_code}" -o release_out.json -H "Authorization: token $TOKEN" "$API/repos/$REPO/releases/tags/$TAG")
|
||||
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\"")
|
||||
|
||||
if [ "$HTTP_STATUS" = "200" ]; then
|
||||
echo "Release $TAG already exists."
|
||||
RELEASE_ID="$(jq -r .id release_out.json)"
|
||||
else
|
||||
echo "Creating release for $TAG"
|
||||
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_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_ID="$(echo "$RELEASE_JSON" | jq -r .id)"
|
||||
fi
|
||||
|
||||
curl -fsS -X POST "$API/repos/$REPO/releases/$RELEASE_ID/assets?name=$ASSET_NAME" \
|
||||
-H "Authorization: token $TOKEN" \
|
||||
-F "attachment=@$ASSET_PATH"
|
||||
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\""
|
||||
|
|
|
|||
Loading…
Reference in a new issue