From ec838c257634bcad21363c336ddb00fe24dff076 Mon Sep 17 00:00:00 2001 From: Kurt Himebauch <136133082+xXJSONDeruloXx@users.noreply.github.com> Date: Tue, 13 Oct 2026 11:17:41 -0400 Subject: [PATCH] Align Discord build names with the app (#726) --- .github/workflows/build.yml | 9 ++++--- docs/development/discord-build-channels.md | 29 ++++++++++++++++++++++ tools/release/pr_discord.py | 5 ++-- 3 files changed, 37 insertions(+), 6 deletions(-) create mode 100644 docs/development/discord-build-channels.md diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 6845dc0695..eb1fc8d9d9 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -628,10 +628,11 @@ jobs: # Each signed main build as a prerelease of the public Droid-Deck/DroidDeck-CI (main-, the # last KEEP kept), where anyone can download it without a GitHub account, then a post in the - # Discord's builds channel linking to it. The release is made with a token of the org's + # Discord's #preview channel linking to it. The release is made with a token of the org's # "DroidDeck CI Publisher" app (installed on DroidDeck-CI only, Contents: write): its ID in the # DROIDDECK_CI_APP_ID variable, its private key in the DROIDDECK_CI_APP_KEY secret. - # DISCORD_BUILDS_WEBHOOK is the channel's webhook URL. + # DISCORD_BUILDS_WEBHOOK is the channel's webhook URL. Keep this secret name when renaming + # the channel: Discord routes the existing webhook by channel ID, not its display name. announce: needs: [build, sign] if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main' @@ -733,7 +734,7 @@ jobs: echo "apk=$GITHUB_SERVER_URL/$CI_REPO/releases/download/$tag/$apk" >> "$GITHUB_OUTPUT" echo "Published $url" - - name: Post to Discord + - name: Post the Preview build to Discord env: WEBHOOK: ${{ secrets.DISCORD_BUILDS_WEBHOOK }} GH_TOKEN: ${{ github.token }} @@ -757,7 +758,7 @@ jobs: what="[\`${GITHUB_SHA::7}\`]($GITHUB_SERVER_URL/$GITHUB_REPOSITORY/commit/$GITHUB_SHA): $subject" fi get=$(printf 'Download: [standard APK](<%s>) · [all variants](<%s>)' "$APK" "$RELEASE") - content=$(printf '**New signed build** `main-%s`\n%s\n%s' "${GITHUB_SHA::7}" "$what" "$get") + content=$(printf '**New signed Preview build** `main-%s`\n%s\nIn the app: **Updates → Preview**\n%s' "${GITHUB_SHA::7}" "$what" "$get") jq -n --arg content "$content" '{content: $content, allowed_mentions: {parse: []}}' | curl -fsS -H 'Content-Type: application/json' -d @- "$WEBHOOK" -o /dev/null echo "Posted: $content" diff --git a/docs/development/discord-build-channels.md b/docs/development/discord-build-channels.md new file mode 100644 index 0000000000..f6ebf3c8cc --- /dev/null +++ b/docs/development/discord-build-channels.md @@ -0,0 +1,29 @@ +# Discord build channels + +Use the same names as the app's Updates page: + +| App | Discord | Builds | Existing webhook secret | +| --- | --- | --- | --- | +| Preview | [#preview](https://discord.com/channels/1552707793247539220/1554202932965015583) | Signed builds of `main`, including merged fixes | `DISCORD_BUILDS_WEBHOOK` | +| Test builds | [#test-builds](https://discord.com/channels/1552707793247539220/1557605185365217340) | Signed builds of individual open pull requests | `DISCORD_PR_BUILDS_WEBHOOK` | + +Stable contains tested releases published from version tags. Preview contains the newest +merged fixes before Stable; Test builds let users try an unmerged fix by its PR number. + +## Renaming safely + +Rename the existing Discord channels in place. Keep their IDs, permissions, and webhooks. +The webhook URLs used by `build.yml`, `pr-release-publish.yml`, and `pr-release-cleanup.yml` +route by ID, so changing a channel's name or topic needs no secret rotation or routing change. +Keep the existing GitHub secret names even though they use the old channel terminology. + +PR publication saves `webhook_id` and `message_id` in the signed build report comment. +Republishing edits that message; closing or merging the PR retires it. Neither operation +looks up a Discord channel by name. Keep the existing webhook so those saved references +continue to work. Recreating a channel or webhook is a different operation and needs a +separate migration. + +For future renames, check the channel and webhook IDs before and after, verify that the +existing webhook token can still read an earlier build message, and inspect the next +publish/update/retirement runs. Separately hosted bots may have their own configuration; +this repository only controls the GitHub Actions build announcements. diff --git a/tools/release/pr_discord.py b/tools/release/pr_discord.py index 6b1b01f4b9..b577df247b 100644 --- a/tools/release/pr_discord.py +++ b/tools/release/pr_discord.py @@ -103,10 +103,11 @@ def description_excerpt(body): def build_content(repo, number, title, sha, apk, release, description=None): excerpt = description_excerpt(description) - return (f"**Signed PR test build** `pr-{number}` · `{sha[:7]}`\n" + return (f"**Signed test build** `pr-{number}` · `{sha[:7]}`\n" f"[#{number}](https://github.com/{repo}/pull/{number}): {plain_title(title)}\n" + (f"\n{excerpt}\n\n" if excerpt else "") + "_Not merged — for testing._\n" + f"In the app: **Updates → Test builds → #{number}**\n" f"Download: [standard APK](<{apk}>) · [all variants](<{release}>)") @@ -116,7 +117,7 @@ def retired_content(content, merged): content = "\n".join(line[2:-2] if line.startswith("~~") and line.endswith("~~") else line for line in content.splitlines()[2:]) struck = "\n".join(f"~~{line}~~" if line else "" for line in content.splitlines()) - return f"**{label}** — this PR test build is no longer available.\n\n{struck}" + return f"**{label}** — this test build is no longer available.\n\n{struck}" def sync(mode, repo, number, discord, sha="", apk="", release=""):