Files
jacob-mathison a89f454ec0
ci/woodpecker/push/woodpecker Pipeline failed
Lint and Build Checks / Lint, Test, and Build (push) Failing after 393h4m58s
fix(ci): deploy hosted app over ssh
2026-06-23 10:32:39 -05:00

65 lines
1.7 KiB
Bash
Executable File

#!/bin/sh
set -eu
status="${1:-unknown}"
title="${2:-Bone Kingdom deploy update}"
color="${3:-5793266}"
target_url="${DEPLOY_TARGET_URL:-http://bone-kingdom.tabitha.tealthrone/}"
commit="${CI_COMMIT_SHA:-unknown}"
short_commit="$(printf '%s' "$commit" | cut -c 1-12)"
branch="${CI_COMMIT_BRANCH:-unknown}"
repo="${CI_REPO:-jacob-mathison/blb-throne-of-the-bone-king}"
build_url="${CI_PIPELINE_URL:-${CI_BUILD_LINK:-http://localhost:13580/}}"
webhook_url="${DISCORD_DEPLOY_WEBHOOK_URL:-}"
if [ -z "$webhook_url" ]; then
echo "DISCORD_DEPLOY_WEBHOOK_URL is not configured; skipping Discord notification."
exit 0
fi
node - "$status" "$title" "$color" "$target_url" "$repo" "$branch" "$short_commit" "$build_url" "$webhook_url" <<'NODE'
const [
status,
title,
color,
targetUrl,
repo,
branch,
shortCommit,
buildUrl,
webhookUrl,
] = process.argv.slice(2);
const payload = {
content: `Bone Kingdom deploy status: ${status}`,
embeds: [
{
title,
url: targetUrl,
color: Number(color),
fields: [
{ name: 'Status', value: status, inline: true },
{ name: 'Repo', value: repo, inline: true },
{ name: 'Branch', value: branch, inline: true },
{ name: 'Commit', value: shortCommit, inline: true },
{ name: 'Target', value: targetUrl, inline: false },
{ name: 'Build', value: buildUrl, inline: false },
],
},
],
};
const response = await fetch(webhookUrl, {
method: 'POST',
headers: { 'Content-Type': 'application/json' },
body: JSON.stringify(payload),
});
if (!response.ok) {
const responseBody = await response.text();
console.error(`Discord notification failed: ${response.status} ${responseBody}`);
process.exit(1);
}
NODE