Skip to content

fix: untangle macOS release notarization#123

Open
ibourgeois wants to merge 1 commit intomainfrom
codex/fix-122-release-notarization
Open

fix: untangle macOS release notarization#123
ibourgeois wants to merge 1 commit intomainfrom
codex/fix-122-release-notarization

Conversation

@ibourgeois
Copy link
Contributor

Closes #122.

Summary

  • stop NativePHP's Electron afterSign hook from notarizing during the build job
  • notarize the signed app bundle explicitly in the workflow before stapling it
  • make macOS artifact discovery a bit more resilient and easier to debug

Verification

  • ruby -e 'require "yaml"; YAML.load_file(".github/workflows/tagged-release.yml")'

Copilot AI review requested due to automatic review settings March 25, 2026 06:24
Copy link
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR adjusts the tagged macOS release workflow to prevent NativePHP/Electron’s afterSign hook from notarizing during the build, and instead performs app notarization explicitly in the workflow before stapling—making artifact discovery and failure diagnostics more reliable.

Changes:

  • Add a workflow-level flag to skip NativePHP’s built-in afterSign notarization and patch the upstream hook at runtime.
  • Make DMG discovery more resilient and print directory contents when expected artifacts aren’t found.
  • Explicitly archive and notarize the .app bundle in the workflow prior to stapling.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment on lines +267 to +278
const marker = " console.log('aftersign hook triggered, start to notarize app.')\n";
const snippet = " if (process.env.KATRA_SKIP_NATIVEPHP_AFTERSIGN_NOTARIZE === 'true') {\n console.log('skipping NativePHP afterSign notarization because the workflow notarizes artifacts explicitly.')\n return\n }\n\n";

if (! pattern.test(normalized)) {
throw new Error('Unable to locate the NativePHP notarization error handler.');
if (normalized.includes('KATRA_SKIP_NATIVEPHP_AFTERSIGN_NOTARIZE')) {
process.exit(0);
}

const updated = normalized.replace(pattern, "$1 throw error\n$2");
if (! normalized.includes(marker)) {
throw new Error('Unable to locate the NativePHP afterSign hook marker.');
}

const updated = normalized.replace(marker, marker + snippet);
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The patching logic depends on an exact hard-coded marker string (including indentation and the full log message). This makes the workflow brittle to small upstream NativePHP changes (e.g., different whitespace/message), causing releases to fail even though the hook is still present. Consider matching more flexibly (e.g., a regex on the afterSign log line or function boundary) and/or validating that the inserted guard is placed inside the expected function before writing.

Copilot uses AI. Check for mistakes.
Comment on lines +361 to +362
echo "Discovered files under nativephp/electron/dist:" >&2
find nativephp/electron/dist -maxdepth 3 -print | sort >&2
Copy link

Copilot AI Mar 25, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

With set -euo pipefail enabled, the debug find nativephp/electron/dist ... | sort will cause this step to exit early if nativephp/electron/dist doesn't exist (or find returns non-zero for any reason), preventing the clearer "No macOS ... was generated" errors from running. Wrap this diagnostic block so it can’t fail the step (e.g., check [[ -d nativephp/electron/dist ]] first, or append || true).

Suggested change
echo "Discovered files under nativephp/electron/dist:" >&2
find nativephp/electron/dist -maxdepth 3 -print | sort >&2
if [[ -d nativephp/electron/dist ]]; then
echo "Discovered files under nativephp/electron/dist:" >&2
find nativephp/electron/dist -maxdepth 3 -print | sort >&2 || true
else
echo "Directory nativephp/electron/dist does not exist." >&2
fi

Copilot uses AI. Check for mistakes.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

fix: untangle macOS release notarization from NativePHP build

2 participants