Skip to content

Commit f50c57d

Browse files
committed
save
1 parent 3b0afba commit f50c57d

File tree

1 file changed

+85
-32
lines changed

1 file changed

+85
-32
lines changed

scripts/make-upgrade-proposal

Lines changed: 85 additions & 32 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
#!/usr/bin/env bash
2-
set -xeuo pipefail
2+
set -euo pipefail
33

44
# THIS SCRIPT IS A WORK IN PROGRESS
55
#
@@ -288,6 +288,11 @@ wait_for_release_text_change() {
288288
echo "Go to the release page"
289289
echo "Change title to release-YYYY-MM-DD: (Friendly and explanatory title)"
290290
echo "Add a paragraph after the first one summarizing the upgrade changes"
291+
if [ -f release_notes.md ]; then
292+
echo ""
293+
echo "A combined What's Changed summary has been generated in release_notes.md."
294+
echo "You can paste its contents into the release page."
295+
fi
291296
echo "Release page: https://github.com/dfinity/internet-identity/releases/tag/$TAG_NAME"
292297
}
293298

@@ -302,13 +307,13 @@ wait_for_archive_canister_hash() {
302307
download_wasms() {
303308
local upgrade_type="$(checklist_must_get 'Upgrade type')"
304309
if should_upgrade_backend "$upgrade_type"; then
305-
curl -sSL https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_production.wasm.gz -o internet_identity.wasm.gz
306-
curl -sSL https://github.com/dfinity/internet-identity/releases/latest/download/archive.wasm.gz -o archive.wasm.gz
310+
curl -sSL https://github.com/dfinity/internet-identity/releases/download/$TAG_NAME/internet_identity_production.wasm.gz -o internet_identity.wasm.gz
311+
curl -sSL https://github.com/dfinity/internet-identity/releases/download/$TAG_NAME/archive.wasm.gz -o archive.wasm.gz
307312
fi
308313
if should_upgrade_frontend "$upgrade_type"; then
309314
# NOTE: The CI workflow must publish internet_identity_frontend.wasm.gz to GitHub releases
310315
# If this download fails, ensure the release workflow includes the frontend WASM artifact
311-
curl -sSL https://github.com/dfinity/internet-identity/releases/latest/download/internet_identity_frontend.wasm.gz -o internet_identity_frontend.wasm.gz
316+
curl -sSL https://github.com/dfinity/internet-identity/releases/download/$TAG_NAME/internet_identity_frontend.wasm.gz -o internet_identity_frontend.wasm.gz
312317
fi
313318
}
314319

@@ -516,17 +521,46 @@ EOF
516521

517522
download_proposal_text() {
518523
local upgrade_type="$(checklist_must_get 'Upgrade type')"
519-
local release_body=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/dfinity/internet-identity/releases/latest | jq -cMr '.body')
520-
524+
local release_body=$(curl -H "Accept: application/vnd.github.v3+json" https://api.github.com/repos/dfinity/internet-identity/releases/tags/$TAG_NAME | jq -cMr '.body')
525+
526+
# Source paths for filtering commits by canister
527+
local -a backend_paths=(
528+
src/internet_identity/
529+
src/internet_identity_interface/
530+
src/archive/
531+
src/asset_util/
532+
src/canister_tests/
533+
)
534+
local -a frontend_paths=(
535+
src/internet_identity_frontend/
536+
src/frontend/
537+
src/lingui-svelte/
538+
src/showcase/
539+
src/vite-plugins/
540+
)
541+
542+
local backend_commits=""
543+
local frontend_commits=""
544+
521545
if should_upgrade_backend "$upgrade_type"; then
522546
# Find last backend proposal tag
523547
local last_backend_tag=$(git tag -l "proposal-backend-*" | sort -V | tail -1)
524548

525-
if [ -n "$last_backend_tag" ]; then
526-
local commit_range="${last_backend_tag}..${TAG_NAME}"
527-
local backend_commits=$(git log --oneline --no-merges "$commit_range")
528-
529-
cat > backend_proposal.md << EOF
549+
if [ -z "$last_backend_tag" ]; then
550+
echo "No previous proposal-backend-* tag found."
551+
echo "Available release tags:"
552+
git tag -l "release-*" | sort -V | tail -5
553+
read -p "Enter the tag or commit of the last backend deployment: " last_backend_tag
554+
if ! git rev-parse "$last_backend_tag" >/dev/null 2>&1; then
555+
echo "Error: '$last_backend_tag' is not a valid tag or commit" >&2
556+
exit 1
557+
fi
558+
fi
559+
560+
local commit_range="${last_backend_tag}..${TAG_NAME}"
561+
backend_commits=$(git log --oneline --no-merges "$commit_range" -- "${backend_paths[@]}")
562+
563+
cat > backend_proposal.md << EOF
530564
# Backend Canister Upgrade
531565
532566
## Commits since last backend upgrade
@@ -539,26 +573,27 @@ ${backend_commits}
539573
## Release Notes
540574
${release_body}
541575
EOF
542-
else
543-
# No previous backend proposal found
544-
cat > backend_proposal.md << EOF
545-
# Backend Canister Upgrade
546-
547-
## Release Notes
548-
${release_body}
549-
EOF
550-
fi
551576
fi
552577

553578
if should_upgrade_frontend "$upgrade_type"; then
554579
# Find last frontend proposal tag
555580
local last_frontend_tag=$(git tag -l "proposal-frontend-*" | sort -V | tail -1)
556581

557-
if [ -n "$last_frontend_tag" ]; then
558-
local commit_range="${last_frontend_tag}..${TAG_NAME}"
559-
local frontend_commits=$(git log --oneline --no-merges "$commit_range")
560-
561-
cat > frontend_proposal.md << EOF
582+
if [ -z "$last_frontend_tag" ]; then
583+
echo "No previous proposal-frontend-* tag found."
584+
echo "Available release tags:"
585+
git tag -l "release-*" | sort -V | tail -5
586+
read -p "Enter the tag or commit of the last frontend deployment: " last_frontend_tag
587+
if ! git rev-parse "$last_frontend_tag" >/dev/null 2>&1; then
588+
echo "Error: '$last_frontend_tag' is not a valid tag or commit" >&2
589+
exit 1
590+
fi
591+
fi
592+
593+
local commit_range="${last_frontend_tag}..${TAG_NAME}"
594+
frontend_commits=$(git log --oneline --no-merges "$commit_range" -- "${frontend_paths[@]}")
595+
596+
cat > frontend_proposal.md << EOF
562597
# Frontend Canister Upgrade
563598
564599
## Commits since last frontend upgrade
@@ -571,15 +606,33 @@ ${frontend_commits}
571606
## Release Notes
572607
${release_body}
573608
EOF
574-
else
575-
# No previous frontend proposal found
576-
cat > frontend_proposal.md << EOF
577-
# Frontend Canister Upgrade
609+
fi
578610

579-
## Release Notes
580-
${release_body}
611+
# Generate combined two-column summary when upgrading both canisters
612+
if should_upgrade_backend "$upgrade_type" && should_upgrade_frontend "$upgrade_type"; then
613+
local backend_list=$(echo "$backend_commits" | sed 's/^/- /')
614+
local frontend_list=$(echo "$frontend_commits" | sed 's/^/- /')
615+
616+
cat > release_notes.md << EOF
617+
## What's Changed
618+
619+
<table>
620+
<tr><th>Backend</th><th>Frontend</th></tr>
621+
<tr>
622+
<td>
623+
624+
${backend_list}
625+
626+
</td>
627+
<td>
628+
629+
${frontend_list}
630+
631+
</td>
632+
</tr>
633+
</table>
581634
EOF
582-
fi
635+
echo "Combined release notes written to release_notes.md" >&2
583636
fi
584637
}
585638

0 commit comments

Comments
 (0)