Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 8 additions & 3 deletions .github/release-notes/combined-release-template.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,10 +6,15 @@

---

## Image Release Notes
## Image Quick Start & Details

{{IMAGE_NOTES}}
{{IMAGE_DETAILS}}

---

*This is an automated combined release. See individual image releases for detailed changelogs and instructions.*
## What's Changed

{{WHATS_CHANGED}}

---
*This is an automated combined release. See individual image releases for more details.*
58 changes: 58 additions & 0 deletions .github/scripts/generate-combined-release.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,58 @@
import os
import re
import subprocess
import sys

TEMPLATE_PATH = ".github/release-notes/combined-release-template.md"
OUTPUT_PATH = "combined-release.md"

release_version = os.environ.get("RELEASE_VERSION")
artifacts_dir = os.getcwd()
images = ["core-image-minimal", "core-image-medtech"]

# Generate summary table
summary_table = ["| Image | SSH Mode | Artifact |", "|-------|----------|----------|"]
image_details = []
whats_changed_sections = set()

# Find artifact folders (assume artifacts are in subdirs)
for f in sorted([x for x in os.listdir(artifacts_dir) if os.path.isdir(x)]):
for artifact in os.listdir(f):
img = "-".join(artifact.split("-")[:3])
mode_match = re.search(r"(public-hardened|internal-keyed)", artifact)
mode = mode_match.group(1) if mode_match else "-"
summary_table.append(f"| {img} | {mode} | [{artifact}]({f}/{artifact}) |")

for img in images:
tag = f"{img}-{release_version}"
try:
note = subprocess.check_output([
"gh", "release", "view", tag, "--json", "body", "--jq", ".body"
], text=True).strip()
except subprocess.CalledProcessError:
note = f"_No release notes found for {tag}_"
# Extract What's Changed section
match = re.search(r"(?s)(##? What's Changed.*?)(?:\n##|\Z)", note)
if match:
whats_changed_sections.add(match.group(1).strip())
# Remove What's Changed from image details
note_wo_wc = re.sub(r"(?s)##? What's Changed.*", "", note).strip()
image_details.append(f"### {img}\n\n{note_wo_wc}\n")

# Combine What's Changed sections, deduplicated
whats_changed = '\n\n'.join(sorted(whats_changed_sections)) if whats_changed_sections else '_No changes found._'

# Read template
with open(TEMPLATE_PATH, 'r') as f:
template = f.read()

# Replace placeholders
out = template.replace('{{RELEASE_VERSION}}', release_version)
out = out.replace('{{SUMMARY_TABLE}}', '\n'.join(summary_table))
out = out.replace('{{IMAGE_DETAILS}}', '\n'.join(image_details))
out = out.replace('{{WHATS_CHANGED}}', whats_changed)

with open(OUTPUT_PATH, 'w') as f:
f.write(out)

print(f"Combined release notes written to {OUTPUT_PATH}")
26 changes: 2 additions & 24 deletions .github/workflows/combine-release.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,33 +38,11 @@ jobs:
- name: Prepare combined release notes from template
id: notes
run: |
set -e
cp .github/release-notes/combined-release-template.md combined-release.md

# Generate summary table
summary_table="| Image | SSH Mode | Artifact |\n|-------|----------|----------|"
for f in */*; do
img=$(echo "$f" | cut -d'-' -f1-3 | sed 's#/.*$##')
mode=$(echo "$f" | grep -oE '(public-hardened|internal-keyed)' || echo '-')
summary_table+="\n| $img | $mode | [$(basename "$f")]($f) |"
done

# Generate image notes
image_notes=""
for img in core-image-minimal core-image-medtech; do
tag="$img-${{ github.event.inputs.release_version }}"
image_notes+="\n### $img\n"
note=$(gh release view "$tag" --json body --jq '.body' 2>/dev/null || echo "_No release notes found for $tag_")
image_notes+="$note\n"
done

# Replace placeholders in template
sed -i "s|{{RELEASE_VERSION}}|${{ github.event.inputs.release_version }}|g" combined-release.md
sed -i "s|{{SUMMARY_TABLE}}|$summary_table|g" combined-release.md
sed -i "s|{{IMAGE_NOTES}}|$image_notes|g" combined-release.md
python .github/scripts/generate-combined-release.py
cat combined-release.md
env:
GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }}
RELEASE_VERSION: ${{ github.event.inputs.release_version }}

- name: Upload combined release notes
uses: actions/upload-artifact@v4
Expand Down
Loading