mirror of
https://github.com/anomalyco/opencode.git
synced 2026-11-20 18:57:17 +03:00
chore(release): announce releases in Discord again (#60371)
This commit is contained in:
committed by
GitHub
Unverified
parent
7ed1f96e29
commit
17f4634afe
Executable
+18
@@ -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"
|
||||
@@ -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]
|
||||
|
||||
Reference in New Issue
Block a user