From a8bf05d83b8c2cc98e65d8bdf7553df4f1a769b3 Mon Sep 17 00:00:00 2001 From: Zanie Blue Date: Fri, 21 Nov 2025 10:45:08 -0600 Subject: [PATCH] Add manual release script (#16799) Unfortunately I need this sometimes --- scripts/manual-github-release.sh | 56 ++++++++++++++++++++++++++++++++ 1 file changed, 56 insertions(+) create mode 100755 scripts/manual-github-release.sh diff --git a/scripts/manual-github-release.sh b/scripts/manual-github-release.sh new file mode 100755 index 000000000..f1fcffabc --- /dev/null +++ b/scripts/manual-github-release.sh @@ -0,0 +1,56 @@ +#!/usr/bin/env bash +# +# Manually perform a GitHub release for a broken automated release that otherwise went out. +# +# PLEASE USE WITH CAUTION. +# +# It can take a while to download all the artifacts. +# +# Requires the `gh` CLI. + +set -euo pipefail + +if [ ! -n "$COMMIT" ]; then + echo "COMMIT is required." + exit 1 +fi + +if [ ! -n "$RUN_ID" ]; then + echo "RUN_ID is required." + exit 1 +fi + +# Create directory for artifacts +mkdir -p "release_$RUN_ID" +cd "release_$RUN_ID" + +REPO=$(gh repo view --json nameWithOwner | jq .nameWithOwner -r) + +# Download all artifacts for the workflow run +gh run download "$RUN_ID" --repo "$REPO" --pattern 'artifacts-*' + +MANIFEST="artifacts-dist-manifest/dist-manifest.json" + +# Extract values from manifest +TAG=$(jq -r '.announcement_tag // .tag' "$MANIFEST") +TITLE=$(jq -r '.announcement_title' "$MANIFEST") +BODY=$(jq -r '.announcement_github_body' "$MANIFEST") +PRERELEASE=$(jq -r '.announcement_is_prerelease' "$MANIFEST") + +# Write body to temp file +echo "$BODY" > /tmp/notes.txt + +# Merge artifacts-* directories into artifacts/ (like CI does) +mkdir -p artifacts +cp -r artifacts-*/* artifacts/ + +# Remove the granular manifests (like CI does) +rm -f artifacts/*-dist-manifest.json + +# Create release +gh release create "$TAG" \ + --target "$COMMIT" \ + --title "$TITLE" \ + --notes-file /tmp/notes.txt \ + "$([ "$PRERELEASE" = "true" ] && echo "--prerelease")" \ + artifacts/*