Use the pinned release signer for PR APKs

This commit is contained in:
xXJSONDeruloXx committed 2026-09-24 20:16:28 -04:00
1 parent 7aa56118ae
commit 2a0f859701
4 files changed
+15 -10

No files matched your search

+3 -2
View File
@@ -499,8 +499,9 @@ jobs:
# An apk is a zip already; compressing it again buys nothing and costs seconds.
compression-level: 0
# Only main is signed with DroidDeck's private key. Pull requests and other branches keep the
# public AOSP testkey build, so unreviewed branch code never gets access to the release key.
# This workflow signs only main. PR build jobs keep using the public AOSP test key; the separate
# main-only approval workflow can later sign an approved PR artifact without running PR code with
# the release key.
sign:
needs: build
if: github.event_name != 'pull_request' && github.ref == 'refs/heads/main'
+7 -4
View File
@@ -200,18 +200,21 @@ jobs:
- name: Verify the release signer and checksum
env:
EXPECTED_SHA256: b241ea7d7e8180e2e58a8a2cc6e819eedc36eff5a0a04f382a34cabba4b5d3f0
APK_NAME: ${{ needs.authorize.outputs.apk_name }}
run: |
set -euo pipefail
apk="signed/$APK_NAME"
test -s "$apk" || { echo "::error::Signed APK is missing: $APK_NAME"; exit 1; }
expected_sha256=$(tr -d '[:space:]' < keystore/release-signer.sha256)
[[ "$expected_sha256" =~ ^[[:xdigit:]]{64}$ ]] || {
echo "::error::keystore/release-signer.sha256 is not a SHA-256 digest"; exit 1;
}
sdk=${ANDROID_HOME:-${ANDROID_SDK_ROOT:-}}
[[ -n "$sdk" && -d "$sdk/build-tools" ]] || { echo "::error::Android build-tools are unavailable"; exit 1; }
tools=$(find "$sdk/build-tools" -mindepth 1 -maxdepth 1 -type d | sort -V | tail -1)
certs=$("$tools/apksigner" verify --min-sdk-version 28 --print-certs "$apk")
digest=$(sed -n 's/.*certificate SHA-256 digest: //p' <<<"$certs" | sort -u)
[[ "$digest" == "$EXPECTED_SHA256" ]] || {
[[ "$digest" == "$expected_sha256" ]] || {
printf '%s\n' "$certs" >&2
echo "::error::PR APK is not signed with the release certificate"; exit 1;
}
@@ -226,7 +229,6 @@ jobs:
APK_NAME: ${{ needs.authorize.outputs.apk_name }}
SOURCE_REPO: ${{ github.repository }}
TARGET_REPO: Droid-Deck/DroidDeck-CI
SIGNING_CERT_SHA256: b241ea7d7e8180e2e58a8a2cc6e819eedc36eff5a0a04f382a34cabba4b5d3f0
run: |
set -euo pipefail
if [ -z "$GH_TOKEN" ]; then
@@ -236,6 +238,7 @@ jobs:
pr=$(gh api "repos/$SOURCE_REPO/pulls/$PR_NUMBER")
title=$(jq -r '.title' <<<"$pr" | tr '\r\n' ' ' | sed 's/[[:space:]]\+/ /g; s/ $//')
url=$(jq -r '.html_url' <<<"$pr")
signing_cert_sha256=$(tr -d '[:space:]' < keystore/release-signer.sha256)
tag="pr-$PR_NUMBER"
notes=$(mktemp)
trap 'rm -f "$notes"' EXIT
@@ -244,7 +247,7 @@ jobs:
printf 'Title: %s\n\n' "$title"
printf 'Source PR: %s\n' "$url"
printf "Source commit: \`%s\`\n" "$HEAD_SHA"
printf "Signed with DroidDeck release certificate SHA-256 \`%s\`.\n" "$SIGNING_CERT_SHA256"
printf "Signed with DroidDeck release certificate SHA-256 \`%s\`.\n" "$signing_cert_sha256"
printf 'This is a review-approved test build. Back up app data before installing test builds.\n'
} > "$notes"
if view_out=$(gh api "repos/$TARGET_REPO/releases/tags/$tag" 2>&1); then
+3 -3
View File
@@ -3,10 +3,10 @@ name: Sign APKs
# Called, never run by itself: turns a "Build APK" apk into packages signed with DroidDeck's own key,
# one matrix job per package in tools/release/variants.txt (tools/release/sign-apk.sh does the work
# and checks it). The key lives only in the GitHub environment named by the caller:
# signing-main builds of main
# signing-main main builds and maintainer-approved PR artifacts
# release manually dispatched release.yml from main
# PR CI stays test-key-only. The main-only PR Release Publish workflow may call this after it checks
# for an approving maintainer review, green CI, the exact current PR commit, and the stable versionCode.
# PR Build APK jobs stay test-key-only. PR Release Publish calls this from main only after approval,
# green CI, the exact current commit, and the stable versionCode have been checked.
on:
workflow_call: