Repository navigation
DEV-1395: Signing-key check and release-notes list for ShimmerCapture releases - #147
Conversation
On the runner apksigner prints 'V2 Signer: certificate SHA-256 digest', not 'Signer #1 …', as the first dry run on master showed. Also says how Play Console formats the same digest. Co-Authored-By: Claude Opus 5.5 <[email protected]>
ShimmerCapture is not enrolled in Play App Signing, so there is no upload key certificate in Play Console to compare with. Records the certificate every release is signed with (checked against the published 1.3.3 APK), how to read it from Play's App bundle explorer, and that enrolling is not part of a release. Co-Authored-By: Claude Opus 5.5 <[email protected]>
…he run summary The build job writes every PR merged since the last ShimmerCapture tag to the run summary, so a dry run gives the material for the Play release notes (whats_new) before anything is tagged. Same PRs as the GitHub release's generated notes, which the read-only build job cannot call: it reads the merge commits, including PRs merged into a branch that later reached master, and needs only pull-requests: read. It never blocks a release. RELEASING.md gains 'Writing whats_new': where the list comes from, how to turn it into user-facing notes (1.3.4's as the example), and the generate-notes command for previewing without a dry run. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jyong15
left a comment
There was a problem hiding this comment.
Review of the signing-key and changes-list additions. Nothing here blocks the release. The most useful change is to have the workflow check the signing certificate itself, instead of only documenting it (comment on RELEASING.md L64). The second is the misleading "No merged PRs found." when git log fails (workflow L187). The rest are minor.
🤖 Generated with Claude Code
| list the GitHub release's notes will have. Write the Play release notes from it (see | ||
| *Writing whats_new* below). | ||
| - **build** → *Collect and check the APK* prints the APK's `versionCode` and `versionName`, and its | ||
| `certificate SHA-256 digest` (apksigner labels the line `V2 Signer:` or `Signer #1`). It must be |
There was a problem hiding this comment.
The certificate is recorded here but the workflow never checks it. Collect and check the APK only prints apksigner verify --print-certs, so a person has to compare it by eye.
With a wrong or rotated SHIMMERCAPTURE_KEYSTORE_BASE64 secret, a real run still tags ShimmerCapture_vX, creates the GitHub pre-release and uploads to Play. Only Play rejects it, after the tag and release are already public.
Suggestion: have the Collect step fail when the digest is missing, e.g.
certs=$("$build_tools/apksigner" verify --print-certs "../release-assets/$name")
echo "$certs"
grep -qi 5f353cb90d2452e2d83309837a57b72950003e1470d873899a573e2441123e19 <<<"$certs" \n || { echo "::error::APK is not signed with the ShimmerCapture release key."; exit 1; }This works whatever apksigner calls the line (V2 Signer or Signer #1), so this paragraph no longer needs to explain both labels.
There was a problem hiding this comment.
Done in 736f5e2. Collect and check the APK now fails unless the APK carries RELEASE_CERT_SHA256 (an env on that step, with a comment on when to change it), with ::error::The APK is not signed with the ShimmerCapture release key. It runs before the release and play jobs, so nothing is tagged or uploaded, and it fails dry runs too. The grep matches certificate SHA-256 digest: <sha>, so it works for both V2 Signer: and Signer #1. Checked against both formats with the release digest (pass), and against a throwaway key, the Android debug key, and the digest on the SHA-1 line (all fail). RELEASING.md now says the workflow checks it, drops the by-eye comparison and the two labels, and the failure table has a row for the new error.
| for n in $numbers; do | ||
| gh api "repos/$GITHUB_REPOSITORY/pulls/$n" --jq '"* \(.title) (#\(.number))"' || echo "* #$n" | ||
| done | ||
| [ -n "$numbers" ] || echo "No merged PRs found." |
There was a problem hiding this comment.
If git log fails, the summary still says "No merged PRs found." The step runs under the default bash -e, without pipefail. A failing git log "$range" inside the pipeline leaves numbers empty, and continue-on-error hides the rest.
PREVIOUS_TAG comes from gh release list, which also returns draft releases and releases whose tag has been deleted. #149's after-merge plan deletes a release and its tag. If the release outlives its tag, the release manager is told there is nothing to write whats_new from. Suggestion: check git rev-parse -q --verify "refs/tags/$PREVIOUS_TAG" first and emit a ::warning::, or use set -o pipefail.
There was a problem hiding this comment.
Done in 736f5e2, at the source as well as in the step. The version step now takes the newest published ShimmerCapture release whose tag still exists, skipping drafts, and warns about any release it skips for having no tag. This also fixes a silent gap you led me to: with a tagless previous release, the versionCode check's git show failed into 2>/dev/null and the check passed without comparing anything. The list step has set -o pipefail. A failing git log now gives a ::warning:: and "Could not list the changes: git log <range> failed" in the summary, and an empty range says "No PRs merged since ". Tested: a missing tag, an empty range (a temporary local tag on master's tip), and a stand-in gh returning a release with no tag (skipped with the warning, falls back to v1.3.3).
| run: | | ||
| range=${PREVIOUS_TAG:+refs/tags/$PREVIOUS_TAG..}HEAD | ||
| numbers=$(git log --reverse --format=%s "$range" \ | ||
| | sed -nE 's/^Merge pull request #([0-9]+) .*/\1/p; s/.*\(#([0-9]+)\)$/\1/p' | awk '!seen[$0]++') |
There was a problem hiding this comment.
The (#N) suffix pattern can list unrelated PRs. This repo merges with merge commits; no subject on master ends in (#N) today, so this branch is currently unused. It also matches any subject ending in (#N), including references to other repos' PRs. For example, a port commit … driver CRC fix (#319) meaning Shimmer-Java-Android-API#319 would list this repo's #319 as a change in the release.
Suggestion: drop the pattern while squash merging is off, or keep only PRs whose merged_at is set.
There was a problem hiding this comment.
Agreed, dropped in 736f5e2. Only Merge pull request #N … subjects are matched now, and the step's comment says a squash-merged PR would not be listed.
| *Test and release* → *App integrity* → **Upload key certificate**. If it doesn't, Play rejects the | ||
| upload. | ||
| - The run's **summary** page lists every PR merged since the last ShimmerCapture release: the same | ||
| list the GitHub release's notes will have. Write the Play release notes from it (see |
There was a problem hiding this comment.
"The same list the GitHub release's notes will have" holds today, but only by coincidence. The summary parses git log subjects, while generate-notes uses GitHub's own commit-to-PR association and applies any .github/release.yml exclusions (labels, bots). Add such a config, or squash-merge one PR, and the two lists diverge while this sentence still says they are identical. Consider "the same PRs" plus how they are found, rather than a promise that the lists match.
There was a problem hiding this comment.
Reworded in 736f5e2. The summary bullet now says the PRs are found from the merge commits between the last release's tag and the commit being built. The generate-notes section says the two lists find PRs differently and can differ, e.g. for a squash-merged PR.
| echo "Pick the ones users notice for the Play release notes (whats_new, 500 characters max)." | ||
| echo | ||
| for n in $numbers; do | ||
| gh api "repos/$GITHUB_REPOSITORY/pulls/$n" --jq '"* \(.title) (#\(.number))"' || echo "* #$n" |
There was a problem hiding this comment.
Minor: this makes one REST call per PR, one after another. With no previous ShimmerCapture tag the range is all of history, about 150 calls. A single GraphQL query with aliased pullRequest(number: N) fields would fetch every title in one request.
There was a problem hiding this comment.
Done in 736f5e2: one GraphQL request with an aliased pullRequest(number: N) per PR. A PR it cannot read shows as "(title not found)", and a failed request falls back to numbers with a warning. 1.3.3 → master lists the same 33 PRs, all with titles.
| released and the last one: | ||
|
|
||
| ```bash | ||
| gh api repos/ShimmerResearch/ShimmerAndroidAPI/releases/generate-notes -f tag_name=ShimmerCapture_v1.3.5 -f target_commitish=master -f previous_tag_name=ShimmerCapture_v1.3.4 --jq .body |
There was a problem hiding this comment.
Minor: the preview uses target_commitish=master, but the release job passes $GITHUB_SHA. If a PR merges between the preview and the run, the whats_new written from the preview can describe a PR that is not in the APK. Worth a note that this is master as of now, or showing a SHA instead.
There was a problem hiding this comment.
Noted in 736f5e2. Under the preview command, RELEASING.md now says both lists are of master as it is when you look, that a PR merged before the run is in the APK but not in your notes, and to look again just before running.
| # | ||
| # dry_run builds the signed APK (unsigned without the keystore) and keeps it as a workflow artifact, | ||
| # from any branch, and publishes nothing. The workflow also dry-runs on any PR that changes this file. | ||
| # from any branch, and publishes nothing. Its summary lists the changes for whats_new. The workflow also dry-runs on any PR that changes this file. |
There was a problem hiding this comment.
Nit: this line is about 140 characters long; the rest of the header wraps at about 100.
- Collect and check the APK fails unless a signed APK carries the ShimmerCapture release certificate (RELEASE_CERT_SHA256), before anything is tagged or uploaded. RELEASING.md drops the by-eye check. - The previous release is the newest published ShimmerCapture release whose tag still exists. A tagless release made the versionCode check and the changes list compare against nothing. - The changes list runs with pipefail and says so when git log fails, instead of "No merged PRs found"; it matches merge commits only, and reads every title in one GraphQL request. - RELEASING.md no longer promises the summary and generate-notes lists are identical, and says both are of master as it is when looked at. - Wrap the long header line. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jyong15
left a comment
There was a problem hiding this comment.
Re-review at 736f5e2. All seven earlier comments are addressed, thanks. Taking the previous tag only from published releases whose tag still exists is a nice fix, and so is the certificate check. This commit adds two problems, inline below. The first is worth fixing before merge, because it brings back the silent skip of the versionCode check this commit set out to remove.
🤖 Generated with Claude Code
| # whose tag was deleted, has no tag to compare against: the versionCode check below and | ||
| # the changes list would then silently compare against nothing. | ||
| PREVIOUS_TAG= | ||
| for t in $(gh release list --repo "$GITHUB_REPOSITORY" --limit 200 --json tagName,createdAt,isDraft \ |
There was a problem hiding this comment.
A failed gh release list no longer stops the step. Before, PREVIOUS_TAG=$(gh release list …) was an assignment, so bash -e stopped the step when the call failed. Inside a for … in $(…) word list, the substitution's exit status is ignored:
$ bash -ec 'for t in $(false); do :; done; echo reached'
reached
So a rate limit, token problem or API outage leaves PREVIOUS_TAG empty, and the run carries on. The versionCode check is skipped. On a real release, generate-notes is called without previous_tag_name, so GitHub picks its own previous release: currently AndroidAPI_v3.2.12_beta, not a ShimmerCapture tag.
Suggestion: capture the list first, so -e checks it, then loop:
releases=$(gh release list --repo "$GITHUB_REPOSITORY" --limit 200 --json tagName,createdAt,isDraft --jq '…')
for t in $releases; doThere was a problem hiding this comment.
Good catch, fixed in 2a60699 as you suggested: releases=$(gh release list …) first, so -e stops the step if gh fails, then for t in $releases. A comment there says why. Reproduced your bash -ec 'for t in $(false)…' first. Then tested the extracted step with a gh that fails ("HTTP 403"): it stops with exit 1, where before it carried on with no previous tag.
| query="query(\$owner: String!, \$name: String!) { repository(owner: \$owner, name: \$name) {" | ||
| for n in $numbers; do query+=" pr$n: pullRequest(number: $n) { number title }"; done | ||
| query+=" } }" | ||
| titles=$(gh api graphql -f query="$query" -F owner="${GITHUB_REPOSITORY%/*}" \ |
There was a problem hiding this comment.
One PR number GitHub can't resolve blanks every title. When the GraphQL response contains any error, gh api graphql exits 1 and prints the raw JSON without applying --jq. I reproduced it against this repo with aliases for #146 and a non-existent #99999:
exit=1 stdout=[{"data":{"repository":{"pr146":{"number":146,"title":"DEV-1395: …"},"pr99999":null}},"errors":[…]}]
titles then holds that JSON, the awk lookup matches nothing, and every PR is listed as "(title not found)". The warning also says the request failed when most of it worked. It needs a merge subject naming a PR this repo can't resolve, so it's unlikely, but the fallback doesn't work as the reply describes.
Suggestion: keep the response and run jq on it separately:
resp=$(gh api graphql -f query="$query" -F owner=… -F name=…) \
|| echo "::warning::Some PR titles could not be read."
titles=$(jq -r '.data.repository // {} | .[] | select(.) | "\(.number)\t\(.title)"' <<<"$resp")There was a problem hiding this comment.
Confirmed (exit 1, raw JSON with data intact) and fixed in 2a60699: the response goes to resp, with a warning if gh fails, and jq -r '.data.repository // {} | .[] | select(.) | …' runs on it separately. So an unresolvable PR loses only its own title. Checked the expression on a real response that has a null entry: the titles are kept and the null skipped. An empty response gives no lines rather than an error. There's no jq binary on my Windows machine, so I ran the expression through gh's own engine; ubuntu-latest ships jq.
- The version step lists the releases by assignment before looping. In "for t in $(gh …)" a failed gh was ignored under -e, leaving no previous tag and so skipping the versionCode check again. - The changes list runs jq on the GraphQL response itself. When one PR in the query can't be resolved, gh exits 1 and prints the raw response without applying --jq, so every title was lost; now only that PR's is. Co-Authored-By: Claude Opus 5.5 <[email protected]>
jyong15
left a comment
There was a problem hiding this comment.
Re-reviewed 2a60699: both follow-up comments are fixed (the release list is assigned before the loop so -e stops on a failed gh, and jq runs separately so one unresolvable PR loses only its own title). Nothing new found. Approving; merge once CI is green.
Follow-up to #146, after the first signed dry run on master (run 41407171381), with the review below addressed.
Signing key
RELEASE_CERT_SHA256(CN=Shimmer,5f353cb9…41123e19, the key on the published 1.3.3 APK and the 1.3.4 dry run). It does this before anything is tagged or uploaded, so a wrong or replaced keystore secret is caught here, not by Play after the tag and release are public.Previous release
The previous release is now the newest published ShimmerCapture release whose tag still exists, with a warning for any it skips. Before, a release whose tag had been deleted (as happened to 1.3.4) was picked anyway, and the versionCode check then compared against nothing and passed.
Changes list for the Play release notes
whats_newbefore anything is tagged.Merge pull request #Ncommits, including PRs merged into a branch that later reached master. All titles come from one GraphQL request, with onlypull-requests: read. The step runs withpipefail, reports a failinggit loginstead of "no PRs", andcontinue-on-errorkeeps it from blocking a release.generate-notespreview, and a note that both lists are of master as it is when looked at.Tested locally
V2 Signer:,Signer #1). Fails a throwaway key, the Android debug key, and the digest on the SHA-1 line.🤖 Generated with Claude Code