(fix): workflow
This commit is contained in:
parent
cf6201fe18
commit
f252724a43
1 changed files with 29 additions and 14 deletions
|
|
@ -97,17 +97,32 @@ jobs:
|
|||
ASSET_NAME: ${{ steps.version.outputs.asset_name }}
|
||||
DESCRIPTION: ${{ inputs.description }}
|
||||
run: |
|
||||
nix-shell -p curl jq --run '
|
||||
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
|
||||
echo "Release $TAG already exists."
|
||||
RELEASE_ID="$(jq -r .id release_out.json)"
|
||||
else
|
||||
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)"
|
||||
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"
|
||||
'
|
||||
Loading…
Reference in a new issue