Skip to content

Open source CapCut alternative.

TypeScript

fix(ci): codesign against the signing keychain explicitly so release signing finds the identity

David Le6c9b1ccb1184
diff --git a/.github/workflows/promote-donkey-release.yml b/.github/workflows/promote-donkey-release.yml
index 41076883..5a44e48a 100644
--- a/.github/workflows/promote-donkey-release.yml
+++ b/.github/workflows/promote-donkey-release.yml
@@ -133,7 +133,11 @@ jobs:
keychain="$RUNNER_TEMP/donkey-signing.keychain-db"
kpw="$(uuidgen)"
security create-keychain -p "$kpw" "$keychain"
- security set-keychain-settings -lut 21600 "$keychain"
+ # No -t/-lut: disable the auto-lock timeout entirely so the keychain stays unlocked across the
+ # later (separate) Package step. With a timeout the long Swift build can elapse and re-lock it,
+ # hiding the private key from codesign — which then reports "no identity found". Safe on an
+ # ephemeral CI runner.
+ security set-keychain-settings "$keychain"
security unlock-keychain -p "$kpw" "$keychain"
echo "$CERT_P12" | base64 --decode > "$RUNNER_TEMP/cert.p12"
security import "$RUNNER_TEMP/cert.p12" -k "$keychain" -P "$CERT_PASSWORD" -T /usr/bin/codesign
@@ -157,6 +161,9 @@ jobs:
echo "$NOTARY_KEY_P8" | base64 --decode > "$RUNNER_TEMP/notary.p8"
fi
echo "identity=$SIGN_IDENTITY" >> "$GITHUB_OUTPUT"
+ # Hand the keychain path to the Package step so codesign can target it explicitly (--keychain)
+ # rather than depending on the search-list state set above carrying across steps.
+ echo "keychain=$keychain" >> "$GITHUB_OUTPUT"
# The bundled CLI tools (ffmpeg, lit, pdf-fill, …) are NOT baked into the app: it downloads
# them on first run from the artifact published by the Publish Bundled Tools workflow, so the
@@ -168,6 +175,7 @@ jobs:
DONKEY_SPARKLE_FEED_URL: https://donkeyuse.com/appcast.xml
DONKEY_SPARKLE_PUBLIC_ED_KEY: ${{ secrets.DONKEY_SPARKLE_PUBLIC_ED_KEY }}
DONKEY_APP_SIGN_IDENTITY: ${{ steps.signing.outputs.identity }}
+ DONKEY_SIGN_KEYCHAIN: ${{ steps.signing.outputs.keychain }}
DONKEY_NOTARY_KEY_P8: ${{ runner.temp }}/notary.p8
DONKEY_NOTARY_KEY_ID: ${{ secrets.DONKEY_NOTARY_KEY_ID }}
DONKEY_NOTARY_ISSUER_ID: ${{ secrets.DONKEY_NOTARY_ISSUER_ID }}
diff --git a/scripts/package-donkey-app.sh b/scripts/package-donkey-app.sh
index 62cc7959..1b2957af 100755
--- a/scripts/package-donkey-app.sh
+++ b/scripts/package-donkey-app.sh
@@ -216,6 +216,11 @@ sign_app() {
return 0
fi
local base=(--force --options runtime --timestamp --sign "$APP_SIGN_IDENTITY")
+ # Target the signing keychain explicitly when the release workflow points us at one. Relying on the
+ # user keychain search list is unreliable here: the keychain is imported in a separate CI step, and
+ # that search-list state doesn't dependably reach codesign in this step (hence "no identity found"
+ # even though the identity imported fine).
+ [ -n "${DONKEY_SIGN_KEYCHAIN:-}" ] && base=(--keychain "$DONKEY_SIGN_KEYCHAIN" "${base[@]}")
local sparkle="$FRAMEWORKS_DIR/Sparkle.framework"
if [ -d "$sparkle" ]; then
# Versions/Current keeps this agnostic to Sparkle's version letter.
@@ -255,7 +260,9 @@ notarize_app() {
# opens without a Gatekeeper prompt.
notarize_dmg() {
[ "$APP_SIGN_IDENTITY" = "-" ] && return 0
- codesign --force --timestamp --sign "$APP_SIGN_IDENTITY" "$DMG_PATH"
+ local dmg_sign=(--force --timestamp --sign "$APP_SIGN_IDENTITY")
+ [ -n "${DONKEY_SIGN_KEYCHAIN:-}" ] && dmg_sign=(--keychain "$DONKEY_SIGN_KEYCHAIN" "${dmg_sign[@]}")
+ codesign "${dmg_sign[@]}" "$DMG_PATH"
echo "Notarizing the disk image ..."
notarytool_submit "$DMG_PATH"
xcrun stapler staple "$DMG_PATH"
@@ -297,6 +304,7 @@ stage_bundled_tools() {
# (e.g. exiftool) just no-ops here.
local sopts=(--force --sign "$APP_SIGN_IDENTITY")
[ "$APP_SIGN_IDENTITY" != "-" ] && sopts+=(--options runtime --timestamp)
+ [ -n "${DONKEY_SIGN_KEYCHAIN:-}" ] && sopts+=(--keychain "$DONKEY_SIGN_KEYCHAIN")
find "$dest_dir" -type f -perm -u+x -print0 | while IFS= read -r -d '' tool; do
chmod +x "$tool"
codesign "${sopts[@]}" "$tool" >/dev/null 2>&1 || true