ci(release): attach per-version notes from PREVIOUS_HISTORY.md to releases

Per-version user-facing changelog moved out of the README table into
PREVIOUS_HISTORY.md (newest-first sections, Development Plan §11.1).
On tag push the workflow now harvests the matching section via
scripts/ci/release-notes.py and uses it as the release description,
uploading an Incido-<version>-changes.md beside the APKs; a missing
section falls back to the plain default description. CONTRIBUTING §5
documents the new release-notes maintenance step.
This commit is contained in:
Incido Developer committed 2026-09-17 15:43:20 +12:00
1 parent 576080c8b5
commit 7b6187f99a
5 files changed
+357 -3

No files matched your search

+37 -1
View File
@@ -109,6 +109,20 @@ jobs:
echo "Tag: $TAG Version: $VERSION"
# User-facing release notes: harvest this version's section from
# PREVIOUS_HISTORY.md (maintained per Development Plan §11.1).
# Used as the release description and uploaded beside the APKs.
NOTES_FILE="/tmp/Incido-$VERSION-changes.md"
if python3 scripts/ci/release-notes.py "$VERSION" --out "$NOTES_FILE"; then
HAS_NOTES=1
echo "--- Release notes preview (v$VERSION) ---"
head -12 "$NOTES_FILE"
echo "---"
else
HAS_NOTES=0
echo "No PREVIOUS_HISTORY.md section for v$VERSION - falling back to the default description."
fi
echo "--- Check for existing release ---"
RELEASE_ID=$(curl -s "$API/releases/tags/$TAG" \
-H "Authorization: token $GH_TOKEN" \
@@ -116,7 +130,7 @@ jobs:
if [ -z "$RELEASE_ID" ]; then
echo "--- Create release ---"
python3 -c "import sys,json; sys.stdout.write(json.dumps({'tag_name': '$TAG', 'name': '$TAG', 'body': 'Release $TAG', 'draft': False, 'prerelease': False}))" \
REL_TAG="$TAG" REL_NOTES_FILE="$NOTES_FILE" python3 -c "import json,os; nf=os.environ.get('REL_NOTES_FILE',''); body=(open(nf,encoding='utf-8').read() if nf and os.path.exists(nf) else 'Release '+os.environ['REL_TAG']); print(json.dumps({'tag_name':os.environ['REL_TAG'],'name':os.environ['REL_TAG'],'body':body,'draft':False,'prerelease':False}))" \
> /tmp/release_payload.json
RELEASE_ID=$(curl -s -X POST "$API/releases" \
-H "Authorization: token $GH_TOKEN" \
@@ -125,6 +139,17 @@ jobs:
| python3 -c "import sys,json; print(json.load(sys.stdin).get('id','') or '')")
else
echo "--- Reusing existing release $RELEASE_ID ---"
# Refresh the description even on a rerun, so backfills and
# retried asset uploads always match PREVIOUS_HISTORY.md.
if [ "$HAS_NOTES" = "1" ]; then
echo "--- Patching release description from PREVIOUS_HISTORY.md ---"
REL_NOTES_FILE="$NOTES_FILE" python3 -c "import json,os; print(json.dumps({'body': open(os.environ['REL_NOTES_FILE'],encoding='utf-8').read()}))" \
> /tmp/body_patch.json
curl -s -X PATCH "$API/releases/$RELEASE_ID" \
-H "Authorization: token $GH_TOKEN" \
-H "Content-Type: application/json" \
-d @/tmp/body_patch.json > /dev/null
fi
fi
echo "Release ID: $RELEASE_ID"
@@ -180,5 +205,16 @@ jobs:
upload_asset "$APK" "$APK_PATH" || exit 1
done
# Ship the changelog beside the binaries: people skimming the
# downloads get the notes for exactly this version as a file,
# generated from PREVIOUS_HISTORY.md at the top of this run.
if [ "$HAS_NOTES" = "1" ]; then
NOTES_ASSET="Incido-$VERSION-changes.md"
echo "--- Deleting stale asset for $NOTES_ASSET ---"
python3 /tmp/delete_asset.py "$API" "$RELEASE_ID" "$NOTES_ASSET" "$GH_TOKEN"
cp "$NOTES_FILE" "/tmp/$NOTES_ASSET"
upload_asset "$NOTES_ASSET" "/tmp/$NOTES_ASSET" || exit 1
fi
echo "--- Final release state ---"
curl -s "$API/releases/$RELEASE_ID" -H "Authorization: token $GH_TOKEN" | python3 -c "import sys,json; d=json.load(sys.stdin); print('Release ' + d['tag_name'] + ' has ' + str(len(d['assets'])) + ' assets')"