chore(release): announce releases in Discord again (#60371)

This commit is contained in:
Aiden Cline
2026-10-29 16:20:32 -05:00
committed by GitHub
Unverified
parent 7ed1f96e29
commit 17f4634afe
2 changed files with 34 additions and 0 deletions
+18
View File
@@ -0,0 +1,18 @@
#!/usr/bin/env bash
# publish-discord.sh: announces the v<version> release in Discord with OPENCODE_RELEASE_NOTES (DISCORD_WEBHOOK).
# Discord caps an embed description at 4096 characters, so longer notes are cut and link to the GitHub release.
. "$(dirname "$0")/lib.sh"
tag="v$OPENCODE_VERSION"
payload=$(jq -n --arg tag "$tag" --arg notes "${OPENCODE_RELEASE_NOTES:-}" \
--arg url "https://github.com/$GITHUB_REPOSITORY/releases/tag/$tag" '
($notes | if length > 4000 then .[:4000] + "\n\n[Full release notes](\($url))" else . end) as $description |
{
allowed_mentions: {parse: []},
embeds: [{title: "OpenCode V2 \($tag)", url: $url, color: 2829099} + if $description == "" then {} else {description: $description} end]
}')
echo "$payload" | jq .
if dry_run; then exit 0; fi
test -n "${DISCORD_WEBHOOK:-}" || die "DISCORD_WEBHOOK is not set"
curl -fsS --retry 3 -H "Content-Type: application/json" -d "$payload" "$DISCORD_WEBHOOK"
+16
View File
@@ -733,6 +733,22 @@ jobs:
GH_REPO: ${{ github.repository }}
OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }}
publish-discord:
needs: [plan, publish-github-release]
if: ${{ !cancelled() && !failure() && needs.plan.outputs.release == 'true' }}
runs-on: ubuntu-24.04
environment: ${{ needs.plan.outputs.dry_run != 'true' && 'release' || '' }}
permissions:
contents: read
env: *env
steps:
- *checkout-release
- name: Publish
run: bash .github/release/publish-discord.sh
env:
DISCORD_WEBHOOK: ${{ secrets.DISCORD_WEBHOOK }}
OPENCODE_RELEASE_NOTES: ${{ inputs.release_notes }}
# Brings the release commit back to dev. Pushing to dev is blocked by rulesets, so it opens a PR.
publish-version-pr:
needs: [plan, tag, publish-npm, publish-cli, publish-desktop, publish-github-release]