discourse-release: call a pre-release a release candidate #9
@@ -35,14 +35,19 @@ payload=$(jq -n --arg repo "$REPO" --argjson category "$category_id" --arg ext "
|
||||
--slurpfile ev "$EVENT_PATH" '
|
||||
($ev[0].release) as $r
|
||||
| ($repo | split("/") | last) as $name
|
||||
# A pre-release is a release candidate: said in the title and the first
|
||||
# line, so nobody takes it for what a plain install or `latest` gets.
|
||||
| ($r.prerelease // false) as $rc
|
||||
| {
|
||||
# repo + tag, not the release name: names vary by project (some repeat
|
||||
# the tag, some carry a product name in capitals), tags do not.
|
||||
title: "\($name) \($r.tag_name) released",
|
||||
title: (if $rc then "\($name) \($r.tag_name) release candidate" else "\($name) \($r.tag_name) released" end),
|
||||
category: $category,
|
||||
external_id: $ext,
|
||||
raw: (
|
||||
"**\($name) \($r.tag_name)** is out.\n\n"
|
||||
(if $rc
|
||||
then "**\($name) \($r.tag_name)** is a release candidate: a pre-release for testing, not yet the release. `latest` and a plain install stay where they are.\n\n"
|
||||
else "**\($name) \($r.tag_name)** is out.\n\n" end)
|
||||
+ (if ($r.body // "") == "" then "" else "\($r.body)\n\n" end)
|
||||
+ "---\n[Release on Gitea](\($r.html_url))"
|
||||
)
|
||||
@@ -71,7 +76,7 @@ esac
|
||||
if [ -n "${DISCORD_WEBHOOK:-}" ]; then
|
||||
jq -n --arg u "$url" --slurpfile ev "$EVENT_PATH" --arg repo "$REPO" '
|
||||
($ev[0].release) as $r
|
||||
| {content: ("**\($repo | split("/") | last) \($r.tag_name)** released\n\($u)")[0:1900]}' |
|
||||
| {content: ("**\($repo | split("/") | last) \($r.tag_name)** " + (if ($r.prerelease // false) then "release candidate" else "released" end) + "\n\($u)")[0:1900]}' |
|
||||
curl -fsS -X POST "$DISCORD_WEBHOOK" -H "Content-Type: application/json" --data-binary @- >/dev/null \
|
||||
&& echo "posted to Discord" \
|
||||
|| echo "::warning::Discord webhook failed; the forum post stands"
|
||||
|
||||
Reference in new issue
Block a user